info2man/info2man-1.1.1-mktemp.patch

30 lines
933 B
Diff

--- info2man-1.1.1/info2man 2004-07-17 10:15:54.000000000 +0200
+++ info2man-1.1.1/info2man 2006-05-18 15:34:52.000000000 +0200
@@ -4,12 +4,21 @@
# - Cameron Simpson <cs@zip.com.au> 01nov2000
#
-: ${TMPDIR:=/tmp}
+if [ $# -eq 0 ]
+then
+ echo "Usage: info2man info-file"
+ exit 1
+fi
+
+tmpdir=`mktemp -d /tmp/info2man.XXXXXX` ||
+ { echo "Cannot create directory \`$tmpdir'. Aborting." >&2; exit 1; }
+trap 'ret=$?; rm -rf $tmpdir && exit $ret' 0
+trap '(exit 0); exit' 1 2 13 15
+tmpfile=`env TMPDIR="" mktemp -p $tmpdir tmpfile.XXXXXX` ||
+ { echo "Cannot create temporary file \`$tmpfile'. Aborting." >&2; exit 1; }
xit=0
-tmp=$TMPDIR/i2m$$
-info2pod ${1+"$@"} >$tmp || xit=1
+info2pod ${1+"$@"} >$tmpfile || xit=1
# stderr tossed because of overzealous warnings
-pod2man --lax --center='GNU Info' $tmp 2>/dev/null || xit=1
-rm -f $tmp
+pod2man --lax --center='GNU Info' $tmpfile 2>/dev/null || xit=1
exit $xit