[PATCH, libiberty] mkstemps and binary mode
Mark Shinwell
shinwell@codesourcery.com
Wed May 10 10:23:00 GMT 2006
The following patch opens temporary files in binary mode on Windows to
match up with the behaviour on Unix. I hope this isn't too radical a
change (it's interesting to note that Cygwin has gone down the same path
recently [*]).
Mark
[*] http://www.cygwin.com/ml/cygwin-patches/2006-q2/msg00014.html
--
2006-05-10 Mark Shinwell <shinwell@codesourcery.com>
* mkstemps.c: Open temporary files in binary mode on Windows.
--
Index: mkstemps.c
===================================================================
--- mkstemps.c (revision 113631)
+++ mkstemps.c (working copy)
@@ -119,7 +119,11 @@ mkstemps (char *pattern, int suffix_len)
v /= 62;
XXXXXX[5] = letters[v % 62];
+#ifdef _WIN32
+ fd = open (pattern, O_BINARY|O_RDWR|O_CREAT|O_EXCL, 0600);
+#else
fd = open (pattern, O_RDWR|O_CREAT|O_EXCL, 0600);
+#endif
if (fd >= 0)
/* The file does not exist. */
return fd;
More information about the Gcc-patches
mailing list