diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2019-10-14 06:58:54 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2019-10-14 06:58:54 +0000 |
commit | 4401d8db59bddc76d18f3cea227ec9fa0facd80a (patch) | |
tree | c7c1c3e5da9c43bf3e2849462008401807da57e1 | |
parent | d7f8f10a938852924de0306dac58f493a664562d (diff) |
unpriv(): propagate error code to the caller instead of failing hard.
This will allow reacting on failure.
ok florian@
-rw-r--r-- | usr.sbin/sysupgrade/sysupgrade.sh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/sysupgrade/sysupgrade.sh b/usr.sbin/sysupgrade/sysupgrade.sh index 9bbdb095a18..5f0411376f3 100644 --- a/usr.sbin/sysupgrade/sysupgrade.sh +++ b/usr.sbin/sysupgrade/sysupgrade.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: sysupgrade.sh,v 1.25 2019/09/28 17:30:07 ajacoutot Exp $ +# $OpenBSD: sysupgrade.sh,v 1.26 2019/10/14 06:58:53 ajacoutot Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015 Robert Peichaer <rpe@openbsd.org> @@ -51,7 +51,10 @@ unpriv() fi (($# >= 1)) + # propagate error code to the caller instead of failing hard + set +e eval su -s /bin/sh ${_user} -c "'$@'" || _rc=$? + set -e [[ -n ${_file} ]] && chown root "${_file}" |