Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109412115
D46475.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D46475.diff
View Options
diff --git a/usr.bin/locate/locate/updatedb.sh b/usr.bin/locate/locate/updatedb.sh
--- a/usr.bin/locate/locate/updatedb.sh
+++ b/usr.bin/locate/locate/updatedb.sh
@@ -42,13 +42,14 @@
# The directory containing locate subprograms
: ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR
: ${TMPDIR:=/tmp}; export TMPDIR
-if ! TMPDIR=`mktemp -d $TMPDIR/locateXXXXXXXXXX`; then
+if ! TMPDIR=$(mktemp -d $TMPDIR/locateXXXXXXXXXX); then
exit 1
fi
+tmp=$TMPDIR/_updatedb$$
+trap 'rc=$?; rm -f $tmp; rmdir $TMPDIR; trap - 0; exit $rc' 0 1 2 3 5 10 15
PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH
-
: ${mklocatedb:=locate.mklocatedb} # make locate database program
: ${FCODES:=/var/db/locate.database} # the database
: ${SEARCHPATHS="/"} # directories to be put in the database
@@ -87,17 +88,13 @@
done
fi
-tmp=$TMPDIR/_updatedb$$
-trap 'rm -f $tmp; rmdir $TMPDIR' 0 1 2 3 5 10 15
-
# search locally
if $find -s $SEARCHPATHS $excludes -or -print 2>/dev/null |
$mklocatedb -presort > $tmp
then
- if [ -n "$($find $tmp -size -257c -print)" ]; then
+ if ! grep -aq / $tmp; then
echo "updatedb: locate database $tmp is empty" >&2
exit 1
- else
- cat $tmp > $FCODES # should be cp?
fi
+ install $tmp $FCODES
fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 5, 5:51 PM (20 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16478287
Default Alt Text
D46475.diff (1 KB)
Attached To
Mode
D46475: locate.updatedb: Explicitly exit from trap code.
Attached
Detach File
Event Timeline
Log In to Comment