msvcrt/file.c fopen() ENOENT vs. EBADF
wine.larry.engholm at xoxy.net
wine.larry.engholm at xoxy.net
Thu May 5 09:06:11 CDT 2005
Since 2004/12/14, fopen() of a nonexistent file has incorrectly
resulted in EBADF "Bad file descriptor" rather than ENOENT "No such
file or directory". The bug was introduced in wine/dlls/msvcrt/file.c
revision 1.78. The problem is that when the file doesn't exist,
_close(-1) is called.
Changelog:
Return ENOENT rather than EBADF from MSVCRT_fopen() when file
doesn't exist.
Index: file.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/file.c,v
retrieving revision 1.83
diff -u -p -r1.83 file.c
--- file.c 31 Mar 2005 19:06:10 -0000 1.83
+++ file.c 4 May 2005 14:53:57 -0000
@@ -2360,7 +2360,7 @@ MSVCRT_FILE* MSVCRT_fopen(const char *pa
}
TRACE(":got (%p)\n",file);
- if (!file)
+ if (fd >= 0 && !file)
_close(fd);
UNLOCK_FILES();
return file;
More information about the wine-patches
mailing list