libtiff: * tools/fax2ps.c: replace unsafe tmpfile() with mkstemp()

https://github.com/libsdl-org/libtiff/commit/467aa4ebdc95e66441db43b485919653cc82ad9c

From 467aa4ebdc95e66441db43b485919653cc82ad9c Mon Sep 17 00:00:00 2001
From: Lee Howard <[EMAIL REDACTED]>
Date: Sun, 12 Dec 2010 01:12:29 +0000
Subject: [PATCH]         * tools/fax2ps.c: replace unsafe tmpfile() with
 mkstemp()         http://bugzilla.maptools.org/show_bug.cgi?id=2118

---
 ChangeLog      | 5 +++++
 tools/fax2ps.c | 9 +++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 363dc24b..e6a404b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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
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)