Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/postinstall postinstall: fix contents_owner to retu...



details:   https://anonhg.NetBSD.org/src/rev/6085cb1f7c26
branches:  trunk
changeset: 1008944:6085cb1f7c26
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Apr 06 13:10:48 2020 +0000

description:
postinstall: fix contents_owner to return an error on error

find returning nothing via stdout but does return an error is an error.
Fixes the case where dhcpcd chroot db directory isn't owned by _dhcpcd.

diffstat:

 usr.sbin/postinstall/postinstall.in |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (28 lines):

diff -r f02e3fa290ec -r 6085cb1f7c26 usr.sbin/postinstall/postinstall.in
--- a/usr.sbin/postinstall/postinstall.in       Mon Apr 06 11:58:10 2020 +0000
+++ b/usr.sbin/postinstall/postinstall.in       Mon Apr 06 13:10:48 2020 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.17 2020/04/02 13:44:46 roy Exp $
+# $NetBSD: postinstall.in,v 1.18 2020/04/06 13:10:48 roy Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -738,10 +738,12 @@
        _grp="$4"
 
        if [ "${_op}" = "check" ]; then
-               if [ ! -z "`find "${_dir}" \( ! -user "${_user}" \) -o \
-                   \( ! -group "${_grp}" \)`" ]; then
-                       msg \
-    "${_dir} and contents not all owned by ${_user}:${_grp}"
+               _files=$(find "${_dir}" \( \( ! -user "${_user}" \) -o \
+                               \( ! -group "${_grp}" \) \) )
+               _error=$?
+               if [ ! -z "$_files" ] || [ $_error != 0 ]; then
+                       msg "${_dir} and contents not all owned by" \
+                           "${_user}:${_grp}"
                        return 1
                else
                        return 0



Home | Main Index | Thread Index | Old Index