PATCH: Get rid of superfluous dup() and close() calls.

Martin Wilck Martin.Wilck at Fujitsu-Siemens.com
Mon Feb 3 02:48:34 CST 2003


Am Sam, 2003-02-01 um 10.53 schrieb David Laight:

> No, it causes horrid corruptions that are particularly difficult
> to find.
> 
> What happens is that someone else does an open() and is given
> the number of the (incorrectly) closed fd.  The owener of the fd
> will then write into the newly opened file.

Why is that relevant to Wine? 99% of the Wine code uses DOS/Windows
functions like WriteFile() anyway. All we need to do is make sure that
these functions handle the Unix fd's properly (and they will if they
don't call close()). No user code can ever access the Unix fd's.

I admit my patch isn't small but it also shows that the close() calls
are only in half a dozen source files. In the code that is using the
Unix fd's, however, the close() calls are confusing, ugly, and easy to
forget. 

Martin

-- 
Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck at Fujitsu-Siemens.com
D-33106 Paderborn           http://www.fujitsu-siemens.com/primergy








More information about the wine-devel mailing list