aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorMark Shinwell <shinwell@codesourcery.com>2006-05-28 08:48:00 +0000
committerMark Shinwell <shinwell@gcc.gnu.org>2006-05-28 08:48:00 +0000
commit8967e0295db5621216719a0ea9723774fba31977 (patch)
tree3085800d5c786880e960c1c659ac90d77165410c /libiberty
parent96e5d7455714fe9ed2bb254ee00869307c7ec28d (diff)
downloadgcc-8967e0295db5621216719a0ea9723774fba31977.zip
gcc-8967e0295db5621216719a0ea9723774fba31977.tar.gz
gcc-8967e0295db5621216719a0ea9723774fba31977.tar.bz2
Open temporary files in binary mode when using mkstemps.
From-SVN: r114165
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog4
-rw-r--r--libiberty/mkstemps.c6
2 files changed, 9 insertions, 1 deletions
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 <shinwell@codesourcery.com>
+
+ * mkstemps.c: Open temporary files in binary mode.
+
2006-05-12 Anton Blanchard <anton@samba.org>
* 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;