a2ps/a2ps-4.14-tempfile.patch

28 lines
965 B
Diff
Raw Normal View History

diff -rupN a2ps-4.14.old/contrib/card.in a2ps-4.14/contrib/card.in
--- a2ps-4.14.old/contrib/card.in 2007-12-28 18:11:47.000000000 -0800
+++ a2ps-4.14/contrib/card.in 2014-08-06 20:08:33.925684483 -0700
@@ -41,7 +41,6 @@ LC_ALL="${LC_ALL-C}" export LC_ALL
print_form_feeds=:
RM="/bin/rm -rf"
tmp_dir=`mktemp -d -t card.XXXXXX` || { echo "$program: Cannot create temporary dir!" >&2 ; exit 1; }
-tmp_file=$tmp_dir/card
success=false
verbose=:
version_short="card $card_version (@GNU_PACKAGE@ @VERSION@)"
@@ -192,7 +191,14 @@ if test $# = 0 && test "X$commands" = X;
fi
# Create a tmp dir and be ready to clean up
-trap "$RM $tmp_dir" 0 1 2 15
+if type -p mktemp > /dev/null 2>&1 ; then
+ tmp_dir="`mktemp -d ${tmp_dir}.XXXXXX`" || exit 1
+ trap "$RM $tmp_dir" 0 1 2 3 13 15
+else
+ trap "$RM $tmp_dir" 0 1 2 3 13 15
+ (umask 077 && mkdir $tmp_dir) || exit 1
+fi
+tmp_file=$tmp_dir/card
case $LC_ALL in
fr) footer="Engendr<64> par $version_short" ;;