This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]