This reduces TMPDIR pollution and possibly avoids race conditions with temporary files that are not atomically created.
Based on a patch from Michał Górny <[email protected]>. --- Now uses "mktemp -d" if available. configure | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 6125bcb..64f8b6d 100755 --- a/configure +++ b/configure @@ -2589,19 +2589,23 @@ if ! check_cmd mktemp -u XXXXXX; then # simple replacement for missing mktemp # NOT SAFE FOR GENERAL USE mktemp(){ - echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$" + tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$" + echo "$tmpname" + mkdir "$tmpname" } fi +AVTMPDIR=$(mktemp -d "${TMPDIR}/avconf.XXXXXXXX" 2> /dev/null) || + die "Unable to create temporary directory in $TMPDIR." + tmpfile(){ - tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 && - (set -C; exec > $tmp) 2>/dev/null || + tmp="${AVTMPDIR}/avconf"$2 + (set -C; exec > $tmp) 2> /dev/null || die "Unable to create temporary file in $TMPDIR." - append TMPFILES $tmp eval $1=$tmp } -trap 'rm -f -- $TMPFILES' EXIT +trap 'rm -rf -- "$AVTMPDIR"' EXIT tmpfile TMPASM .asm tmpfile TMPC .c -- 1.9.1 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
