diff options
Diffstat (limited to 'Master/bin/i386-freebsd/mktexlsr')
-rwxr-xr-x | Master/bin/i386-freebsd/mktexlsr | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Master/bin/i386-freebsd/mktexlsr b/Master/bin/i386-freebsd/mktexlsr index 3161a5317ec..5fde39e2c2d 100755 --- a/Master/bin/i386-freebsd/mktexlsr +++ b/Master/bin/i386-freebsd/mktexlsr @@ -10,7 +10,7 @@ # Originally written as `texhash' by Thomas Esser, Okt., 1994. # Public domain. -version='$Id: mktexlsr 36855 2015-04-14 12:15:08Z preining $' +version='$Id: mktexlsr 46343 2018-01-17 00:55:32Z preining $' progname=`echo $0 | sed 's%.*/%%'` usage="Usage: $progname [OPTION]... [DIR]... @@ -73,7 +73,18 @@ if tty -s; then verbose=true; else verbose=false; fi dry_run=false trees= -treefile="${TMPDIR-/tmp}/mktexlsrtrees$$.tmp" +# initialize treefile by either mktemp or some random name +# code taken from pdfjam and adjusted +{ + treefile=` + (umask 077 && mktemp "${TMPDIR-/tmp}/mktexlsrtrees.XXXXXXXXXX") 2>/dev/null + ` && test -n "$treefile" && test -f "$treefile" +} || { + ## We'll use awk to make random number, for portability + random=`awk 'END { srand(); printf ("%d\n", rand()*1000000); }' /dev/null` + treefile="${TMPDIR-/tmp}/mktexlsrtrees$$.$random" +} || exit $? + trap 'cd /; rm -f $treefile; test -z "$db_dir_tmp" || rm -rf "$db_dir_tmp"; exit' 0 1 2 3 7 13 15 |