netpbm/netpbm-tmpfile.patch

48 lines
942 B
Diff
Raw Normal View History

--- editor/pnmindex.csh
+++ editor/pnmindex.csh
@@ -88,7 +88,7 @@
goto usage
endif
-set tmpfile=/tmp/pi.tmp.$$
+set tmpfile=.pi.tmp.$$
rm -f $tmpfile
set maxformat=PBM
--- editor/ppmquantall.csh
+++ editor/ppmquantall.csh
@@ -34,8 +34,8 @@
set heights=( $heights `sed '1d; s/.* //; 2q' $i` )
end
-set all=/tmp/pqa.all.$$
-rm -f $all
+set all=.pqa.all.$$
+
pnmcat -topbottom -jleft -white $files | ppmquant -quiet $newcolors > $all
if ( $status != 0 ) exit $status
--- generator/ppmrainbow
+++ generator/ppmrainbow
@@ -47,7 +47,13 @@
push @colorlist, $ARGV[0];
}
-my $tmpprefix = $tmpdir . "/$myname.$$.";
+my $mytmpdir;
+chomp($mytmpdir = `mktemp -d $tmpdir/ppmrainbow.XXXXXX`);
+if ($? >> 8) {
+ die "Can't create tmpdir";
+}
+
+my $tmpprefix = $mytmpdir . "/file.";
my $widthRemaining;
my $n;
@@ -79,4 +85,5 @@
END {
unlink @outlist if @outlist;
+ rmdir $mytmpdir if -d $mytmpdir;
}