summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-07-01 19:51:47 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-07-01 19:52:44 -0700
commit1188465112a1a3c6acce9d370d448df70fd4fa4d (patch)
tree8c6c70f6553d965de56528379dfdf4548d965aa7
parent4af24b2f5b3f8f2c20271ae323b6fa528b9b2127 (diff)
x11perfcomp should use mktemp instead of pid for tmp directory
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--configure.ac3
-rw-r--r--x11perfcomp.in11
2 files changed, 12 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 0e5c297..1b62a88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,9 @@ AC_TYPE_SIGNAL
# Define the installation directory for the x11 performance compare scripts
AC_SUBST([x11perfcompdir], [$libdir/X11/x11perfcomp])
+# Checks for programs run by the scripts we install
+AC_PATH_PROG(MKTEMP, mktemp)
+
# Checks for pkg-config packages
PKG_CHECK_MODULES(X11PERF, x11 xmuu)
diff --git a/x11perfcomp.in b/x11perfcomp.in
index a541ddc..6956cf2 100644
--- a/x11perfcomp.in
+++ b/x11perfcomp.in
@@ -23,10 +23,17 @@
PATH="@x11perfcompdir@:/bin:/usr/bin:$PATH"
export PATH
+MKTEMP="@MKTEMP@"
+
set -e
-tmp=${TMPDIR-/tmp}/rates.$$
+if [ "x$MKTEMP" != "x" ] && [ -x "$MKTEMP" ] ; then
+ tmp=`$MKTEMP -p /tmp -d rates.XXXXXX`
+ if [ "x$tmp" = "x" ]; then exit 1 ; fi
+else
+ tmp=${TMPDIR-/tmp}/rates.$$
+ mkdir $tmp || exit 1
+fi
trap "rm -rf $tmp" 0 1 2 15
-mkdir $tmp || exit 1
mkdir $tmp/rates
ratio=
allfiles=