diff options
author | ajacoutot <ajacoutot@openbsd.org> | 2019-10-14 06:58:53 +0000 |
---|---|---|
committer | ajacoutot <ajacoutot@openbsd.org> | 2019-10-14 06:58:53 +0000 |
commit | 89522c80b0df87a54143a97fe0fcb022f0ad2e40 (patch) | |
tree | a2c4b0d640055231f20fb2c1d1a583374483a471 /usr.sbin/sysupgrade | |
parent | Better error message when we fail to fetch SHA256.sig. (diff) | |
download | wireguard-openbsd-89522c80b0df87a54143a97fe0fcb022f0ad2e40.tar.xz wireguard-openbsd-89522c80b0df87a54143a97fe0fcb022f0ad2e40.zip |
unpriv(): propagate error code to the caller instead of failing hard.
This will allow reacting on failure.
ok florian@
Diffstat (limited to 'usr.sbin/sysupgrade')
-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}" |