[gs-cvs] rev 8103 - trunk/gs/lib
till at ghostscript.com
till at ghostscript.com
Thu Jul 5 03:31:06 PDT 2007
Author: till
Date: 2007-07-05 03:31:06 -0700 (Thu, 05 Jul 2007)
New Revision: 8103
Modified:
trunk/gs/lib/ps2epsi
Log:
Use mktemp in ps2epsi, bug 689324.
Modified: trunk/gs/lib/ps2epsi
===================================================================
--- trunk/gs/lib/ps2epsi 2007-07-04 22:52:57 UTC (rev 8102)
+++ trunk/gs/lib/ps2epsi 2007-07-05 10:31:06 UTC (rev 8103)
@@ -6,13 +6,21 @@
GS_EXECUTABLE=gs
# try to create a temporary file securely
-tmpdir=/tmp/ps2epsi.$$
-(umask 077 && mkdir $tmpdir)
-if test ! -d $tmpdir; then
- echo "failed: could not create temporary file"
- exit 1
+if test -z "$TMPDIR"; then
+ TMPDIR=/tmp
fi
-tmpfile=$tmpdir/ps2epsi$$
+if which mktemp >/dev/null 2>/dev/null; then
+ tmpfile="`mktemp $TMPDIR/ps2epsi.XXXXXX`"
+else
+ tmpdir=$TMPDIR/ps2epsi.$$
+ (umask 077 && mkdir "$tmpdir")
+ if test ! -d "$tmpdir"; then
+ echo "failed: could not create temporary file"
+ exit 1
+ fi
+ tmpfile="$tmpdir"/ps2epsi$$
+fi
+trap "rm -rf \"$tmpfile\"" 0 1 2 3 7 13 15
export outfile
@@ -60,11 +68,11 @@
print "end";
exit(0);
}
- ' U="$USERNAME$LOGNAME" F=1 - F=2 "${infile}" >$tmpfile
+ ' U="$USERNAME$LOGNAME" F=1 - F=2 "${infile}" >"$tmpfile"
-$GS_EXECUTABLE -q -dNOPAUSE -dSAFER -dDELAYSAFER -r72 -sDEVICE=bit -sOutputFile=/dev/null $tmpfile ps2epsi.ps $tmpfile <"${infile}" 1>&2
-rm -f $tmpfile
-rm -rf $tmpdir
+$GS_EXECUTABLE -q -dNOPAUSE -dSAFER -dDELAYSAFER -r72 -sDEVICE=bit -sOutputFile=/dev/null "$tmpfile" ps2epsi.ps "$tmpfile" <"${infile}" 1>&2
+rm -f "$tmpfile"
+rm -rf "$tmpdir"
(
cat << BEGINEPS
More information about the gs-cvs
mailing list