diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-04-09 08:25:27 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-04-09 08:25:27 +0000 |
commit | 08d1f4952f67f347db6a288b4a0187f8b0d7bbf7 (patch) | |
tree | 3a5d0117ff1b663915f042e1b1e031a6c931f6a8 /gnu/usr.bin/groff/libgroff/tmpfile.cc | |
parent | 098fe4a0b368c914c7d1f7ce086634958df8796a (diff) |
groff 1.15 plus local changes (insomnia strikes):
o moved *.man to *.$section_in and generate *.$section not *.n for bsd.man.mk
o modified groff Makefiles to not install man pages (we do it ourselves)
o use mkstemp everywhere
o don't install groff versions on mdoc macros, we want our own ones
Diffstat (limited to 'gnu/usr.bin/groff/libgroff/tmpfile.cc')
-rw-r--r-- | gnu/usr.bin/groff/libgroff/tmpfile.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gnu/usr.bin/groff/libgroff/tmpfile.cc b/gnu/usr.bin/groff/libgroff/tmpfile.cc index 280d87c5e22..43d75f3b4df 100644 --- a/gnu/usr.bin/groff/libgroff/tmpfile.cc +++ b/gnu/usr.bin/groff/libgroff/tmpfile.cc @@ -69,18 +69,18 @@ FILE *xtmpfile() int fd = mkstemp(templ); if (fd < 0) fatal("cannot create temporary file: %1", strerror(errno)); - errno = 0; - FILE *fp = fdopen(fd, "w+"); - if (!fp) - fatal("fdopen: %1", strerror(errno)); #else /* not HAVE_MKSTEMP */ if (!mktemp(templ) || !templ[0]) fatal("cannot create file name for temporary file"); errno = 0; - FILE *fp = fopen(templ, "w+"); - if (!fp) + int fd = open(templ, O_CREAT|O_EXCL|O_RDWR, S_IRUSR|S_IWUSR); + if (fd < 0) fatal("cannot open `%1': %2", templ, strerror(errno)); #endif /* not HAVE_MKSTEMP */ + errno = 0; + FILE *fp = fdopen(fd, "w+"); + if (!fp) + fatal("fdopen: %1", strerror(errno)); if (unlink(templ) < 0) error("cannot unlink `%1': %2", templ, strerror(errno)); a_delete templ; |