[FFmpeg-cvslog] r23393 - in branches/0.5: . configure
siretart
subversion
Mon May 31 15:06:52 CEST 2010
Author: siretart
Date: Mon May 31 15:06:51 2010
New Revision: 23393
Log:
configure: improve temp file creation and cleanup
backport r17752 by mru
Modified:
branches/0.5/ (props changed)
branches/0.5/configure
Modified: branches/0.5/configure
==============================================================================
--- branches/0.5/configure Mon May 31 12:47:36 2010 (r23392)
+++ branches/0.5/configure Mon May 31 15:06:51 2010 (r23393)
@@ -261,7 +261,6 @@ Include the log file "$logfile" produced
solving the problem.
EOF
fi
- rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
exit 1
}
@@ -1358,13 +1357,36 @@ esac
: ${TMPDIR:=$TMP}
: ${TMPDIR:=/tmp}
-TMPC="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
-TMPE="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
-TMPH="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
-TMPO="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
-TMPS="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
-TMPV="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.ver"
-TMPSH="${TMPDIR}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
+
+if ! check_cmd type mktemp; then
+ # simple replacement for missing mktemp
+ # NOT SAFE FOR GENERAL USE
+ mktemp(){
+ echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
+ }
+fi
+
+
+tmpfile(){
+ tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
+ (set -C; exec > $tmp) 2>/dev/null ||
+ die "Unable to create temoporary file in $TMPDIR."
+ append TMPFILES $tmp
+ eval $1=$tmp
+}
+
+trap 'rm -f -- $TMPFILES' EXIT
+trap exit HUP INT TERM
+
+tmpfile TMPC .c
+tmpfile TMPE $EXESUF
+tmpfile TMPH .h
+tmpfile TMPO .o
+tmpfile TMPS .S
+tmpfile TMPV .ver
+tmpfile TMPSH .sh
+
+unset -f mktemp
# make sure we can execute files in $TMPDIR
cat > $TMPSH 2>> $logfile <<EOF
@@ -1378,7 +1400,6 @@ variable to another directory and make s
EOF
die "Sanity test failed."
fi
-rm $TMPSH
if $cc --version 2>/dev/null | grep -qi gcc; then
cc_type=gcc
@@ -2522,8 +2543,6 @@ cmp -s $TMPH config.h &&
echo "config.h is unchanged" ||
mv -f $TMPH config.h
-rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
-
# build tree in object directory if source path is different from current one
if enabled source_path_used; then
DIRS="\
More information about the ffmpeg-cvslog
mailing list