diff options
author | peter <peter@FreeBSD.org> | 1999-12-11 14:58:02 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-12-11 14:58:02 +0000 |
commit | 17ef7b81d643aaa65e7aaba16d54f2baec7e1e7c (patch) | |
tree | fa0799678a58bfe0283687e3195ae9f506a85de2 /contrib/cvs/src/filesubr.c | |
parent | afa6f15fc776bfa99c2d1c399bf36073c33a3c81 (diff) | |
download | FreeBSD-src-17ef7b81d643aaa65e7aaba16d54f2baec7e1e7c.zip FreeBSD-src-17ef7b81d643aaa65e7aaba16d54f2baec7e1e7c.tar.gz |
Take a shot at using mkstemp() since we have a __warn_references() on
the other temporary file creation functions..
Diffstat (limited to 'contrib/cvs/src/filesubr.c')
-rw-r--r-- | contrib/cvs/src/filesubr.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/contrib/cvs/src/filesubr.c b/contrib/cvs/src/filesubr.c index ae64460..83f7fb9 100644 --- a/contrib/cvs/src/filesubr.c +++ b/contrib/cvs/src/filesubr.c @@ -686,6 +686,23 @@ xcmp (file1, file2) 4.3), and as last resort tmpnam (POSIX). Reason is that tempnam and mktemp both allow to specify the directory in which the temporary file will be created. */ +#if 1 +char * +cvs_temp_name () +{ + char *value; + int retval; + + value = xmalloc (strlen (Tmpdir) + 40); + sprintf (value, "%s/%s", Tmpdir, "cvsXXXXXX"); + retval = mkstemp (value); + + if (retval == -1) + error (1, errno, "cannot generate temporary filename"); + close (retval); + return value; +} +#else #ifdef HAVE_TEMPNAM char * cvs_temp_name () @@ -725,6 +742,7 @@ cvs_temp_name () # endif } #endif +#endif /* Return non-zero iff FILENAME is absolute. Trivial under Unix, but more complicated under other systems. */ |