diff --git a/usr.bin/locate/locate/updatedb.sh b/usr.bin/locate/locate/updatedb.sh index 97c586badd88..29c30bc902d5 100644 --- a/usr.bin/locate/locate/updatedb.sh +++ b/usr.bin/locate/locate/updatedb.sh @@ -26,7 +26,7 @@ # # updatedb - update locate database for local mounted filesystems # -# $Id: updatedb.sh,v 1.10 1998/03/08 16:09:31 wosch Exp $ +# $Id: updatedb.sh,v 1.11 1998/06/18 09:26:22 wosch Exp $ LOCATE_CONFIG="/etc/locate.rc" if [ -f "$LOCATE_CONFIG" -a -r "$LOCATE_CONFIG" ]; then @@ -35,9 +35,8 @@ fi # The directory containing locate subprograms : ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR -: ${TMPDIR:=/var/tmp}; export TMPDIR -if TMPDIR=`mktemp -d $TMPDIR/locateXXXXXX`; then : -else +: ${TMPDIR:=/tmp}; export TMPDIR +if ! TMPDIR=`mktemp -d $TMPDIR/locateXXXXXX`; then exit 1 fi @@ -74,12 +73,12 @@ case X"$PRUNEPATHS" in esac tmp=$TMPDIR/_updatedb$$ -trap 'rm -f $tmp' 0 1 2 3 5 10 15 +trap 'rm -f $tmp; rmdir $TMPDIR' 0 1 2 3 5 10 15 # search locally # echo $find $SEARCHPATHS $excludes -or -print && exit -if $find $SEARCHPATHS $excludes -or -print 2>/dev/null | - $mklocatedb > $tmp +if $find -s $SEARCHPATHS $excludes -or -print 2>/dev/null | + $mklocatedb -presort > $tmp then case X"`$find $tmp -size -257c -print`" in X) cat $tmp > $FCODES;; @@ -87,5 +86,4 @@ then exit 1 esac fi -rm -f $tmp -rmdir $TMPDIR +echo $?