diff -ur espgs-7.07.1.orig/lib/pj-gs.sh espgs-7.07.1/lib/pj-gs.sh
--- espgs-7.07.1.orig/lib/pj-gs.sh	2002-04-23 13:58:36.000000000 +0200
+++ espgs-7.07.1/lib/pj-gs.sh	2004-09-13 10:04:00.000000000 +0200
@@ -241,6 +241,7 @@
 			then
 				/usr/lib/lprcat $Nofilter $Nolabel $file PCL1 $user $dev
 			else
+				TEMPFILE=`mktemp -t pjXXXXXX` || exit 1
 				type=`file $file | sed 's/^[^:]*..//'`
 				case "$type" in
 				postscript*)
@@ -251,22 +252,22 @@
 #
 #					gs -q -sDEVICE=paintjet -r180 -sOutputFile=- -dDISKFONTS -dNOPAUSE - < $file 2>/tmp/sh$$
 
-					gs -q -sDEVICE=paintjet -r180 -sOutputFile=/tmp/pj$$ -dDISKFONTS -dNOPAUSE - < $file 1>2
-					cat /tmp/pj$$
-					rm /tmp/pj$$
+					gs -q -sDEVICE=paintjet -r180 -sOutputFile=$TEMPFILE -dDISKFONTS -dNOPAUSE - < $file 1>2
+					cat $TEMPFILE
+					rm $TEMPFILE
 					needff=
 					;;
-				*)	cat "$file" 2>/tmp/sh$$
+				*)	cat "$file" 2>$TEMPFILE
 					needff=1
 					;;
 				esac
 
-				if [ -s /tmp/sh$$ ]
+				if [ -s $TEMPFILE ]
 				then
 #				    cat /tmp/sh$$	# output any errors
-				    cat /tmp/sh$$ 1>2	# output any errors
+				    cat $TEMPFILE 1>2	# output any errors
 				fi
-				rm -f /tmp/sh$$
+				rm -f $TEMPFILE
 				if [ $needff ]; then echo "\014\r\c"; fi
 			fi
 
diff -ur espgs-7.07.1.orig/lib/ps2epsi espgs-7.07.1/lib/ps2epsi
--- espgs-7.07.1.orig/lib/ps2epsi	2003-09-02 20:01:31.000000000 +0200
+++ espgs-7.07.1/lib/ps2epsi	2004-09-13 10:05:31.000000000 +0200
@@ -1,12 +1,7 @@
 #!/bin/sh
 # $Id: gs7.07.1-tempfile.patch,v 1.1 2006/01/05 00:00:18 metalgod Exp $
 
-tmpfile=/tmp/ps2epsi$$
-rm -f $tmpfile
-if test -e $tmpfile; then
-	echo "$0: Our temporary file $tmpfile already exists." 1>&2
-	exit 1
-fi
+tmpfile=`mktemp -t ps2epsiXXXXXX` || exit 1
 trap "rm -rf $tmpfile" 0 1 2 3 7 13 15
 
 export outfile
diff -ur espgs-7.07.1.orig/lib/pv.sh espgs-7.07.1/lib/pv.sh
--- espgs-7.07.1.orig/lib/pv.sh	2002-04-23 13:58:36.000000000 +0200
+++ espgs-7.07.1/lib/pv.sh	2004-09-13 10:08:01.000000000 +0200
@@ -29,9 +29,10 @@
 PAGE=$1
 shift
 FILE=$1
+TEMPFILE=`mktemp -t ${FILE}XXXXXX` || exit 1
 shift
-trap "rm -rf $TEMPDIR/$FILE.$$.pv" 0 1 2 15
+trap "rm -rf $TEMPFILE" 0 1 2 15
 #dvips -D$RESOLUTION -p $PAGE -n 1 $FILE $* -o $FILE.$$.pv
-dvips -p $PAGE -n 1 $FILE $* -o $FILE.$$.pv
-gs $FILE.$$.pv
+dvips -p $PAGE -n 1 $FILE $* -o $TEMPFILE
+gs $TEMPFILE
 exit 0
diff -ur espgs-7.07.1.orig/lib/sysvlp.sh espgs-7.07.1/lib/sysvlp.sh
--- espgs-7.07.1.orig/lib/sysvlp.sh	2002-04-23 13:58:37.000000000 +0200
+++ espgs-7.07.1/lib/sysvlp.sh	2004-09-13 10:14:46.000000000 +0200
@@ -27,20 +27,23 @@
 # Brother HL-4: switch to HP laserjet II+ emulation
 # echo "\033\015H\c"
 
+TEMPDIR=`mktemp -td sysvlp.XXXXXX` || exit 1
+
 i=1
 while [ $i -le $copies ]
 do
 	for file in $files
 	do
 		$GSHOME/gs \
-			-sOUTPUTFILE=/tmp/psp$$.%02d \
+			-sOUTPUTFILE=$TEMPDIR/psp$$.%02d \
 			-sDEVICE=$DEVICE \
 			$EHANDLER $file \
 			< /dev/null >> /usr/tmp/ps_log 2>&1
 
-		cat /tmp/psp$$.* 2>> /usr/tmp/ps_log
-		rm -f /tmp/psp$$.*
+		cat $TEMPDIR/psp$$.* 2>> /usr/tmp/ps_log
+		rm -f $TEMPDIR/psp$$.*
 	done
 	i=`expr $i + 1`
 done
+rmdir $TEMPDIR
 exit 0