Switched from mktemp to mkstemp

This commit is contained in:
Matt Jenkins
2014-04-19 11:36:18 +01:00
parent bbcbed61b0
commit 7205bb7ef2
2 changed files with 13 additions and 2 deletions

View File

@@ -520,7 +520,12 @@ void startup ()
{
register int i;
mktemp (tfilename);
int fd = mkstemp (tfilename);
if (fd == -1) {
uerror ("cannot create temporary file %2", tfilename);
} else {
close(fd);
}
for (i=STEXT; i<SBSS; i++) {
sfile [i] = fopen (tfilename, "w+");
if (! sfile [i])

View File

@@ -1287,7 +1287,13 @@ void middle()
void setupout ()
{
tcreat (&outb, 0);
mktemp (tfname);
int fd = mkstemp (tfname);
if (fd == -1) {
error(2, "internal error: unable to create temporary file %s", tfname);
} else {
close(fd);
}
tcreat (&toutb, 1);
tcreat (&doutb, 1);