PATCH: Get rid of superfluous dup() and close() calls.
wine-devel at sun.consumer.org.il
Sat Feb 1 03:53:28 CST 2003
David Laight wrote:
>>I'm not sure I agree. When someone closes a fd they shouldn't, that
>>would lead to program crashing, and attention being brought to the
>>problem. When someone leaks a fd, noone will notice.
>No, it causes horrid corruptions that are particularly difficult
>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.
>This can happen if a 'normal' program does close(0), close(1),
>close(2) then much later accidentally calls printf() instead
>of sprintf(). When the stdio buffer is eventually flushed data
>is written to what has been reopened as fd0.
>(This was a real bug in software that got released...)
What happens under Windows with such circumstances?
More information about the wine-devel