summaryrefslogtreecommitdiffstats
path: root/usr.bin/locate
diff options
context:
space:
mode:
authorwosch <wosch@FreeBSD.org>1998-11-29 14:46:35 +0000
committerwosch <wosch@FreeBSD.org>1998-11-29 14:46:35 +0000
commita42ed30fc8a9387c425f5431d1d75cfde5a63b83 (patch)
tree12959f7d18e32869189f1cb59ec0b1120864aa58 /usr.bin/locate
parent3b5f1e1ac95d17d392868dd5b702c012b9c1d040 (diff)
downloadFreeBSD-src-a42ed30fc8a9387c425f5431d1d75cfde5a63b83.zip
FreeBSD-src-a42ed30fc8a9387c425f5431d1d75cfde5a63b83.tar.gz
Set TMPDIR to /tmp
Use the new find option -s for sorted output. Remove the temp directory in trap.
Diffstat (limited to 'usr.bin/locate')
-rw-r--r--usr.bin/locate/locate/updatedb.sh16
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.bin/locate/locate/updatedb.sh b/usr.bin/locate/locate/updatedb.sh
index 97c586b..29c30bc 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 $?
OpenPOWER on IntegriCloud