summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2011-10-09 16:46:55 +0000
committerschwarze <schwarze@openbsd.org>2011-10-09 16:46:55 +0000
commit9cc2e2760a607029a21fe319cd334391bb776592 (patch)
treed8ed3f30f1f54541fc28f108111065d07cd4ccfc
parentdon't be too hasty, we can choose to syslog (OR NOT) *after* we parse the (diff)
downloadwireguard-openbsd-9cc2e2760a607029a21fe319cd334391bb776592.tar.xz
wireguard-openbsd-9cc2e2760a607029a21fe319cd334391bb776592.zip
When the _RC_RUNFILE (by some ill chance) happened to be empty or
reading it failed, ${pexp} ended up as the empty string and the script would send SIGTERM to init(1), which was really inconvenient. Fix that by never allowing pexp to become empty. My patch considerably simplified by and ok ajacoutot@.
-rw-r--r--etc/rc.d/rc.subr5
1 files changed, 3 insertions, 2 deletions
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr
index 5c45d5fa058..58af023f9c3 100644
--- a/etc/rc.d/rc.subr
+++ b/etc/rc.d/rc.subr
@@ -1,4 +1,4 @@
-# $OpenBSD: rc.subr,v 1.52 2011/10/09 08:48:53 ajacoutot Exp $
+# $OpenBSD: rc.subr,v 1.53 2011/10/09 16:46:55 schwarze Exp $
#
# Copyright (c) 2010, 2011 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -34,7 +34,8 @@ rc_write_runfile() {
}
rc_read_runfile() {
- [ -f ${_RC_RUNFILE} ] && pexp=$(< ${_RC_RUNFILE})
+ [ -f ${_RC_RUNFILE} ] && local _new_pexp=$(< ${_RC_RUNFILE})
+ [ -n "${_new_pexp}" ] && pexp="${_new_pexp}"
}
rc_rm_runfile() {