Source-Changes-HG archive

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

[src/trunk]: src/distrib/sets Instead of using mktemp -d (which isn't availab...



details:   https://anonhg.NetBSD.org/src/rev/2f24ff88c089
branches:  trunk
changeset: 524880:2f24ff88c089
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Mon Apr 01 15:50:30 2002 +0000

description:
Instead of using mktemp -d (which isn't available on many systems), use mkdir
in a loop to create a temporary directory.  Add a few chacks for the sanity
of /tmp first, so as to avoid making the loop infinite.

diffstat:

 distrib/sets/maketars |  24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r e488fa05d3cf -r 2f24ff88c089 distrib/sets/maketars
--- a/distrib/sets/maketars     Mon Apr 01 15:48:56 2002 +0000
+++ b/distrib/sets/maketars     Mon Apr 01 15:50:30 2002 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: maketars,v 1.19 2002/03/01 07:21:14 lukem Exp $
+# $NetBSD: maketars,v 1.20 2002/04/01 15:50:30 bjh21 Exp $
 #
 # Make release tar files for some or all lists.  Usage:
 # maketars [-b] [-x] [-a arch] [-m machine] [-s setsdir]
@@ -85,7 +85,27 @@
        exit 1
 fi
 
-SDIR=`mktemp -d /tmp/maketar.XXXXXX` || exit 1
+# Make sure we don't loop forever if mkdir will always fail.
+
+if [ ! -d /tmp ]; then
+       echo /tmp is not a directory
+       exit 1
+fi
+
+if [ ! -w /tmp ]; then
+       echo /tmp is not writeable
+       exit 1
+fi
+
+SDIR_BASE=/tmp/maketar.$$
+SDIR_SERIAL=0
+
+while true; do
+    SDIR=${SDIR_BASE}.${SDIR_SERIAL}
+    mkdir -m 0700 ${SDIR} && break
+    SDIR_SERIAL=`expr ${SDIR_SERIAL} + 1`
+done    
+
 trap "/bin/rm -rf $SDIR ; exit 0" 0 2 3 13             # EXIT INT QUIT PIPE
 
 if [ -n "$metalog" ]; then



Home | Main Index | Thread Index | Old Index