msvcrt-A09: _close bugfix

Jaco Greeff jaco at puxedo.org
Mon Nov 4 06:15:02 CST 2002


This patch in the msvcrt-A?? series fixes a bug in the _close 
implementation in that a close on a dupped file descriptor from 
STDIN/STDOUT/STDERR might try and free the non-dynamic MSVCRT_FILE* 
structure assigned to the original STDIN/STDOUT/STDERR file descriptor.

License:
LGPL

Changelog:
* dlls/msvcrt/file.c: Jaco Greeff <jaco at puxedo.org>
- Make sure that the _close of _dup'ed file descriptors desn't try to 
free the MSVCRT_FILE structures associated with STDIN/STDOUT/STDERR

--[ inline patch ]--

diff -aurN msvcrt-A08/dlls/msvcrt/file.c msvcrt-A09/dlls/msvcrt/file.c
--- msvcrt-A08/dlls/msvcrt/file.c	Mon Nov  4 13:49:55 2002
+++ msvcrt-A09/dlls/msvcrt/file.c	Mon Nov  4 14:07:29 2002
@@ -474,7 +474,7 @@
              }

              /* Dont free std FILE*'s, they are not dynamic */
-            if (fd > 2 && MSVCRT_files[i])
+            if (i > 2 && MSVCRT_files[i])
              {
                  MSVCRT_free(MSVCRT_files[i]);
                  MSVCRT_files[i] = NULL;




More information about the wine-patches mailing list