This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, libiberty] mkstemps and binary mode
- From: Mark Shinwell <shinwell at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 May 2006 09:42:03 +0100
- Subject: [PATCH, libiberty] mkstemps and binary mode
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;