summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/usr.bin/groff/indxbib/indxbib.cc8
-rw-r--r--gnu/usr.bin/groff/xditview/Dvi.c5
2 files changed, 7 insertions, 6 deletions
diff --git a/gnu/usr.bin/groff/indxbib/indxbib.cc b/gnu/usr.bin/groff/indxbib/indxbib.cc
index fe310c35bb3..fb353247c80 100644
--- a/gnu/usr.bin/groff/indxbib/indxbib.cc
+++ b/gnu/usr.bin/groff/indxbib/indxbib.cc
@@ -219,12 +219,12 @@ int main(int argc, char **argv)
else {
temp_index_file = strsave(TEMP_INDEX_TEMPLATE);
}
- if (!mktemp(temp_index_file) || !temp_index_file[0])
+ int fd = mkstemp(temp_index_file);
+ if (fd == -1 || !temp_index_file[0])
fatal("cannot create file name for temporary file");
catch_fatal_signals();
- int fd = creat(temp_index_file, S_IRUSR|S_IRGRP|S_IROTH);
- if (fd < 0)
- fatal("can't create temporary index file: %1", strerror(errno));
+ if (fchmod(fd, S_IRUSR|S_IRGRP|S_IROTH) < 0)
+ fatal("cannot change permissions for temporary file");
indxfp = fdopen(fd, "w");
if (indxfp == 0)
fatal("fdopen failed");
diff --git a/gnu/usr.bin/groff/xditview/Dvi.c b/gnu/usr.bin/groff/xditview/Dvi.c
index fe4eee2c114..312f686e677 100644
--- a/gnu/usr.bin/groff/xditview/Dvi.c
+++ b/gnu/usr.bin/groff/xditview/Dvi.c
@@ -345,12 +345,13 @@ static void OpenFile (dw)
DviWidget dw;
{
char tmpName[sizeof ("/tmp/dviXXXXXX")];
+ int fd;
dw->dvi.tmpFile = 0;
if (!dw->dvi.seek) {
strcpy (tmpName, "/tmp/dviXXXXXX");
- mktemp (tmpName);
- dw->dvi.tmpFile = fopen (tmpName, "w+");
+ fd = mkstemp (tmpName);
+ dw->dvi.tmpFile = fdopen (fd, "w+");
unlink (tmpName);
}
dw->dvi.requested_page = 1;