From bf3d6235698dd6eeffcea4a95724f4bd37d95861 Mon Sep 17 00:00:00 2001 From: shinwell Date: Sun, 28 May 2006 08:48:00 +0000 Subject: [PATCH] Open temporary files in binary mode when using mkstemps. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114165 138bc75d-0d04-0410-961f-82ee72b054a4 --- libiberty/ChangeLog | 4 ++++ libiberty/mkstemps.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index ef48f86..192ba30 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2006-05-28 Mark Shinwell + + * mkstemps.c: Open temporary files in binary mode. + 2006-05-12 Anton Blanchard * cplus-dem.c (demangle_fund_type): Ensure buf is large enough to diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c index 89b37d9..6c2e472 100644 --- a/libiberty/mkstemps.c +++ b/libiberty/mkstemps.c @@ -49,6 +49,10 @@ typedef unsigned long gcc_uint64_t; #define TMP_MAX 16384 #endif +#ifndef O_BINARY +# define O_BINARY 0 +#endif + /* @deftypefn Replacement int mkstemps (char *@var{pattern}, int @var{suffix_len}) @@ -119,7 +123,7 @@ mkstemps (char *pattern, int suffix_len) v /= 62; XXXXXX[5] = letters[v % 62]; - fd = open (pattern, O_RDWR|O_CREAT|O_EXCL, 0600); + fd = open (pattern, O_BINARY|O_RDWR|O_CREAT|O_EXCL, 0600); if (fd >= 0) /* The file does not exist. */ return fd; -- 2.7.4