projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change ARI usage to GNU style
[deliverable/binutils-gdb.git]
/
libiberty
/
mkstemps.c
diff --git
a/libiberty/mkstemps.c
b/libiberty/mkstemps.c
index 89b37d9f4805a4d1822f740603b86bf08c0a02bc..b57880ef0ed7a07baf1c67ba67dbfbeaad28697b 100644
(file)
--- a/
libiberty/mkstemps.c
+++ b/
libiberty/mkstemps.c
@@
-1,4
+1,4
@@
-/* Copyright (C) 1991
, 1992, 1996, 1998, 2004
Free Software Foundation, Inc.
+/* Copyright (C) 1991
-2019
Free Software Foundation, Inc.
This file is derived from mkstemp.c from the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
This file is derived from mkstemp.c from the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@
-35,6
+35,8
@@
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
+#elif HAVE_TIME_H
+#include <time.h>
#endif
#include "ansidecl.h"
#endif
#include "ansidecl.h"
@@
-49,6
+51,10
@@
typedef unsigned long gcc_uint64_t;
#define TMP_MAX 16384
#endif
#define TMP_MAX 16384
#endif
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
/*
@deftypefn Replacement int mkstemps (char *@var{pattern}, int @var{suffix_len})
/*
@deftypefn Replacement int mkstemps (char *@var{pattern}, int @var{suffix_len})
@@
-119,10
+125,17
@@
mkstemps (char *pattern, int suffix_len)
v /= 62;
XXXXXX[5] = letters[v % 62];
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;
if (fd >= 0)
/* The file does not exist. */
return fd;
+ if (errno != EEXIST
+#ifdef EISDIR
+ && errno != EISDIR
+#endif
+ )
+ /* Fatal error (EPERM, ENOSPC etc). Doesn't make sense to loop. */
+ break;
/* This is a random value. It is only necessary that the next
TMP_MAX values generated by adding 7777 to VALUE are different
/* This is a random value. It is only necessary that the next
TMP_MAX values generated by adding 7777 to VALUE are different
This page took
0.025322 seconds
and
4
git commands to generate.