summaryrefslogtreecommitdiff
path: root/libiberty/mkstemps.c
diff options
context:
space:
mode:
authorshinwell <shinwell@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-28 08:48:00 +0000
committershinwell <shinwell@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-28 08:48:00 +0000
commitbf3d6235698dd6eeffcea4a95724f4bd37d95861 (patch)
tree3085800d5c786880e960c1c659ac90d77165410c /libiberty/mkstemps.c
parentdf6caf6c8625474599f7ef4eeb6ea6a09472a279 (diff)
downloadgcc-bf3d6235698dd6eeffcea4a95724f4bd37d95861.tar.gz
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
Diffstat (limited to 'libiberty/mkstemps.c')
-rw-r--r--libiberty/mkstemps.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c
index 89b37d9f480..6c2e472528b 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;