[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PATCH] configure: Put tempfiles in subdir so we can clea

From: Peter Maydell
Subject: [Qemu-trivial] [PATCH] configure: Put tempfiles in subdir so we can clean up libtool files
Date: Tue, 6 May 2014 14:17:00 +0100

When libtool support was added to configure, the new temporary files
were left out of the list of files cleaned up on exit; this results
in a lot of stale .lo files being left around in /tmp. Worse, libtool
creates a /tmp/.libs directory which we can't easily clean up.

Put all our temporary files in a single temporary directory created
via mktemp -d, so we can easily clean it up. This has the bonus
result that we no longer use $RANDOM (which silently expands to the
empty string if your shell is not bash, and so is pretty useless).

Note that because we now use mktemp's tempdir-finding logic rather
than handrolling it, we no longer honour TEMPDIR (only TMPDIR).

Signed-off-by: Peter Maydell <address@hidden>
I don't know why we were looking at TEMPDIR; that code was
in there from the initial commit by Fabrice back in 2003...

 configure | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 870c939..84c600f 100755
--- a/configure
+++ b/configure
@@ -2,26 +2,25 @@
 # qemu configure script (c) 2003 Fabrice Bellard
-# set temporary file name
-if test ! -z "$TMPDIR" ; then
-    TMPDIR1="${TMPDIR}"
-elif test ! -z "$TEMPDIR" ; then
-    TMPDIR1="/tmp"
+TMPDIR1=$(mktemp -t -d)
+if [ $? -ne 0 ]; then
+    echo "ERROR: failed to create temporary directory"
+    exit 1
 # NB: do not call "exit" in the trap handler; this is buggy with some shells;
 # see <address@hidden>
+trap "rm -rf ${TMPDIR1}" EXIT INT QUIT TERM
 rm -f config.log
 # Print a helpful header at the top of config.log

reply via email to

[Prev in Thread] Current Thread [Next in Thread]