summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfaxguy <faxguy>2010-12-12 01:12:29 +0000
committerfaxguy <faxguy>2010-12-12 01:12:29 +0000
commit178786407736377f39763e07bf76d0d0ea815b37 (patch)
treec591882e85ccae12981379818e02958f855fc8dd
parent3f9fd8fc4a124746a9b538ab4835165e1cdc691d (diff)
downloadlibtiff-178786407736377f39763e07bf76d0d0ea815b37.tar.gz
* tools/fax2ps.c: replace unsafe tmpfile() with mkstemp()
http://bugzilla.maptools.org/show_bug.cgi?id=2118
-rw-r--r--ChangeLog5
-rw-r--r--tools/fax2ps.c9
2 files changed, 10 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 363dc24b..e6a404b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2010-12-11 Lee Howard <faxguy@howardsilvan.com>
+ * tools/fax2ps.c: replace unsafe tmpfile() with mkstemp()
+ http://bugzilla.maptools.org/show_bug.cgi?id=2118
+
+2010-12-11 Lee Howard <faxguy@howardsilvan.com>
+
* tools/tiff2pdf.c: add fill-page option
http://bugzilla.maptools.org/show_bug.cgi?id=2051
diff --git a/tools/fax2ps.c b/tools/fax2ps.c
index b2611b94..6c94e3ea 100644
--- a/tools/fax2ps.c
+++ b/tools/fax2ps.c
@@ -1,4 +1,4 @@
-/* $Id: fax2ps.c,v 1.22.2.1 2010-06-08 18:50:43 bfriesen Exp $" */
+/* $Id: fax2ps.c,v 1.22.2.2 2010-12-12 01:12:29 faxguy Exp $" */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -377,11 +377,12 @@ main(int argc, char** argv)
int n;
FILE* fd;
char buf[16*1024];
+ char temp[1024];
- fd = tmpfile();
+ strcpy(temp, "/tmp/fax2psXXXXXX");
+ fd = fdopen(mkstemp(temp), "w+");
if (fd == NULL) {
- fprintf(stderr, "Could not create temporary file, exiting.\n");
- fclose(fd);
+ fprintf(stderr, "Could not create temp file \"%s\"\n", temp);
exit(-2);
}
#if defined(HAVE_SETMODE) && defined(O_BINARY)