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