mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
xzdiff: Use mkdir if mktemp isn't available.
This commit is contained in:
parent
f8c13e5e36
commit
7b03a15cea
1 changed files with 16 additions and 1 deletions
|
@ -139,7 +139,22 @@ elif test $# -eq 2; then
|
|||
test -n "$tmp" && rm -rf "$tmp"
|
||||
(exit 2); exit 2
|
||||
' HUP INT PIPE TERM 0
|
||||
tmp=`mktemp -t -d -- "$prog.XXXXXXXXXX"` || exit 2
|
||||
if type mktemp >/dev/null 2>&1; then
|
||||
tmp=`mktemp -t -d -- "$prog.XXXXXXXXXX"` || exit 2
|
||||
else
|
||||
# Fallback code if mktemp is missing. This isn't as
|
||||
# robust as using mktemp since this doesn't try with
|
||||
# different file names in case of a file name conflict.
|
||||
#
|
||||
# There's no need to save the original umask since
|
||||
# we don't create any non-temp files. Note that using
|
||||
# mkdir -m 0077 isn't secure since some mkdir implementations
|
||||
# create the dir with the default umask and chmod the
|
||||
# the dir afterwards.
|
||||
umask 0077
|
||||
mkdir -- "${TMPDIR-/tmp}/$prog.$$" || exit 2
|
||||
tmp="${TMPDIR-/tmp}/$prog.$$"
|
||||
fi
|
||||
$xz2 -cdfq -- "$2" > "$tmp/$F" || exit 2
|
||||
xz_status=$(
|
||||
exec 4>&1
|
||||
|
|
Loading…
Reference in a new issue