PATCH: GetTempFileName

Marcus Meissner marcus at jet.franken.de
Thu Feb 20 17:04:31 CST 2003


Hi,

If we were starting two programs in the same second which create
the same tempfiles, it would create files with the same filename
and the CreateFile() would return witth ERROR_SHARING_VIOLATION,
not ERROR_FILE_EXISTS.

This comes from EEXIST -> STATUS_OBJECT_NAME_COLLISION translation
in server/file.c which leads to ERROR_SHARING_VIOLATION in the end.

A better fix might to fix that error code translation chain.

Ciao, Marcus

Changelog:
	CreateFile returns ERROR_SHARING_VIOLATION for existing files
	currently.

Index: files/file.c
===================================================================
RCS file: /home/wine/wine/files/file.c,v
retrieving revision 1.177
diff -u -r1.177 file.c
--- files/file.c	11 Jan 2003 21:03:18 -0000	1.177
+++ files/file.c	20 Feb 2003 23:00:13 -0000
@@ -1090,7 +1090,9 @@
                 CloseHandle( handle );
                 break;
             }
-            if (GetLastError() != ERROR_FILE_EXISTS)
+            if ((GetLastError() != ERROR_FILE_EXISTS) &&
+            	(GetLastError() != ERROR_SHARING_VIOLATION)
+	    )
                 break;  /* No need to go on */
             num++;
             sprintf( buf, "%04x.tmp", num );



More information about the wine-patches mailing list