diff options
Diffstat (limited to 'contrib/binutils/libiberty/mkstemps.c')
-rw-r--r-- | contrib/binutils/libiberty/mkstemps.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/contrib/binutils/libiberty/mkstemps.c b/contrib/binutils/libiberty/mkstemps.c index 4b89162..1f6600a 100644 --- a/contrib/binutils/libiberty/mkstemps.c +++ b/contrib/binutils/libiberty/mkstemps.c @@ -49,18 +49,27 @@ typedef unsigned long gcc_uint64_t; #define TMP_MAX 16384 #endif -/* Generate a unique temporary file name from TEMPLATE. +/* - TEMPLATE has the form: +@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len}) - <path>/ccXXXXXX<suffix> +Generate a unique temporary file name from @var{template}. +@var{template} has the form: - SUFFIX_LEN tells us how long <suffix> is (it can be zero length). +@example + @var{path}/ccXXXXXX@var{suffix} +@end example - The last six characters of TEMPLATE before <suffix> must be "XXXXXX"; - they are replaced with a string that makes the filename unique. +@var{suffix_len} tells us how long @var{suffix} is (it can be zero +length). The last six characters of @var{template} before @var{suffix} +must be @samp{XXXXXX}; they are replaced with a string that makes the +filename unique. Returns a file descriptor open on the file for +reading and writing. + +@end deftypefn + +*/ - Returns a file descriptor open on the file for reading and writing. */ int mkstemps (template, suffix_len) char *template; @@ -112,7 +121,11 @@ mkstemps (template, suffix_len) v /= 62; XXXXXX[5] = letters[v % 62]; +#ifdef VMS + fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600, "fop=tmd"); +#else fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600); +#endif if (fd >= 0) /* The file does not exist. */ return fd; |