Module Name:    src
Committed By:   roy
Date:           Mon Apr  6 13:10:48 UTC 2020

Modified Files:
        src/usr.sbin/postinstall: postinstall.in

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.17 src/usr.sbin/postinstall/postinstall.in:1.18
--- src/usr.sbin/postinstall/postinstall.in:1.17	Thu Apr  2 13:44:46 2020
+++ src/usr.sbin/postinstall/postinstall.in	Mon Apr  6 13:10:48 2020
@@ -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 @@ contents_owner()
 	_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

Reply via email to