From e4cad6bb047a7a0d382df46a2bb046097f745e1e Mon Sep 17 00:00:00 2001 From: espie <> Date: Mon, 30 Dec 2019 16:49:51 +0000 Subject: [PATCH] don't suppress error output from running updatelocatedb check that the resulting db works instead of some more specific test okay schwarze@ --- src/etc/weekly | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/etc/weekly b/src/etc/weekly index f4609e4e..c86b9a57 100644 --- a/src/etc/weekly +++ b/src/etc/weekly @@ -1,5 +1,5 @@ # -# $OpenBSD: weekly,v 1.28 2017/04/15 13:12:08 schwarze Exp $ +# $OpenBSD: weekly,v 1.29 2019/12/30 16:49:51 espie Exp $ # # For local additions, create the file /etc/weekly.local. # To get section headers, use the function next_part in weekly.local. @@ -49,13 +49,15 @@ if [ -f /var/db/locate.database ]; then trap 'rm -f $TMP; exit 1' 0 1 15 UPDATEDB="/usr/libexec/locate.updatedb" echo "${UPDATEDB} --fcodes=- --tmpdir=${TMPDIR:-/tmp}" | \ - nice -5 su -m nobody 2>/dev/null 1>$TMP - if [ -s "$TMP" ]; then + nice -5 su -m nobody 1>$TMP + if [ $? -ne 0 ]; then + echo "Rebuilding locate database failed" + elif ! locate -d $TMP /etc/weekly >/dev/null; then + echo "Not installing invalid locate database" + else chmod 444 $TMP chown root:wheel $TMP mv -f $TMP /var/db/locate.database - else - echo "Not installing locate database; zero size" fi else echo "Not rebuilding locate database; can't create temp file"