Take a shot at using mkstemp() since we have a __warn_references() on
the other temporary file creation functions..
This commit is contained in:
parent
5f02be00bc
commit
5e84812fa3
@ -12,6 +12,9 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
*/
|
||||
/*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/* Written by Randy Smith */
|
||||
/* Librarification by Tim Pierce */
|
||||
@ -1274,7 +1277,7 @@ read_diff (filea, fileb, output_placement)
|
||||
*ap++ = fileb;
|
||||
*ap = 0;
|
||||
|
||||
diffout = tmpnam(NULL);
|
||||
diffout = (char *)cvs_temp_name();
|
||||
|
||||
outfile_hold = outfile;
|
||||
callbacks_hold = callbacks;
|
||||
|
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user