diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2021-11-06 13:33:11 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2021-11-06 13:33:11 +0000 |
commit | 8536bd8daee944e2a5861d0e14c418090384e2a7 (patch) | |
tree | 942e896561421f1e83a582aebb36e182040f5625 /etc/rc.d | |
parent | 929f930caf063d97679d8e67142545bd5a406816 (diff) |
Always run _rc_rm_runfile when process is sent a SIGKILL or rc_post fails (at
this point the process has been terminated).
Diffstat (limited to 'etc/rc.d')
-rw-r--r-- | etc/rc.d/rc.subr | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr index a22858899ce..eeb34d99333 100644 --- a/etc/rc.d/rc.subr +++ b/etc/rc.d/rc.subr @@ -1,4 +1,4 @@ -# $OpenBSD: rc.subr,v 1.139 2021/11/06 11:02:53 ajacoutot Exp $ +# $OpenBSD: rc.subr,v 1.140 2021/11/06 13:33:10 ajacoutot Exp $ # # Copyright (c) 2010, 2011, 2014-2021 Antoine Jacoutot <ajacoutot@openbsd.org> # Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -205,7 +205,7 @@ rc_stop() { } rc_cmd() { - local _to _n _ret + local _exit _n _ret [ -n "${1}" ] && echo "${_rc_actions}" | grep -qw -- ${1} || _rc_usage @@ -244,14 +244,14 @@ rc_cmd() { kill -ALRM ${_TIMERSUB} wait ${_TIMERSUB} 2>/dev/null # don't print Alarm clock [[ "${_ret}" == 142 ]] && [ X"${rc_bg}" != X"YES" ] && - _to="timeout" + _exit="timeout" # XXX for unknown reason, rc_check can fail (e.g. redis) # while it just succeeded in _rc_wait; the check is # needed to cope with failing daemons returning 0 #[[ "${_ret}" == @(0|142) ]] && _rc_do rc_check || break [[ "${_ret}" == @(0|142) ]] || break _rc_do _rc_write_runfile - _rc_exit ${_to:=ok} + _rc_exit ${_exit:=ok} done # handle failure type rc_post >/dev/null && _rc_do rc_post @@ -262,12 +262,12 @@ rc_cmd() { _rc_do rc_check || exit 0 echo $_n "${INRC:+ }${_name}" _rc_do rc_stop || _rc_exit failed - _rc_do _rc_wait stop || _rc_exit killed + _rc_do _rc_wait stop || _exit=killed if type rc_post >/dev/null; then - _rc_do rc_post || _rc_exit failed + _rc_do rc_post || _exit=failed fi _rc_do _rc_rm_runfile - _rc_exit ok + _rc_exit ${_exit:=ok} ;; reload) echo $_n "${INRC:+ }${_name}" |