summaryrefslogtreecommitdiff
path: root/etc/rc.d
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2019-01-20 04:52:08 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2019-01-20 04:52:08 +0000
commit9d8ebbe176d2c0898b358ca8de8a91ff8e7ae658 (patch)
tree461e1a7bd83bcbc925948b290327eb02b7d632cb /etc/rc.d
parent2cfc5f9420540a71a43e1256dd191c271d24ff08 (diff)
The shell will strip the quotes from daemon_flags when starting a daemon so make
sure pexp matches the process (i.e. doesn't include the quotes). It's a bit hackish but it allows things like these in rc.conf.local: relayd_flags=-D IPS="1.2.3.4 2.3.4.5" And we properly end up with... $ grep ^pexp /var/run/rc.d/relayd pexp=/usr/sbin/relayd -D IPS=1.2.3.4 1.2.3.5 ... which matches what is in the process list: root 14217 <snip> 0:00.01 /usr/sbin/relayd -D IPS=1.2.3.4 1.2.3.5 There's always the possibility that we have introduced a regressions with hand crafted functions in rc.d scripts (mostly from packags), so watch out. reported by and debugged with claudio@
Diffstat (limited to 'etc/rc.d')
-rw-r--r--etc/rc.d/rc.subr6
1 files changed, 4 insertions, 2 deletions
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr
index 0d887b203de..8b414160fcf 100644
--- a/etc/rc.d/rc.subr
+++ b/etc/rc.d/rc.subr
@@ -1,4 +1,4 @@
-# $OpenBSD: rc.subr,v 1.129 2018/10/29 07:55:40 ajacoutot Exp $
+# $OpenBSD: rc.subr,v 1.130 2019/01/20 04:52:07 ajacoutot Exp $
#
# Copyright (c) 2010, 2011, 2014-2017 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -316,7 +316,9 @@ fi
readonly daemon_class
unset _rcflags _rcrtable _rcuser _rctimeout
-pexp="${daemon}${daemon_flags:+ ${daemon_flags}}"
+# the shell will strip the quotes from daemon_flags when starting a daemon;
+# make sure pexp matches the process (i.e. doesn't include the quotes)
+pexp="$(eval echo ${daemon}${daemon_flags:+ ${daemon_flags}})"
rcexec="su -l -c ${daemon_class} -s /bin/sh ${daemon_user} -c"
[ "${daemon_rtable}" -eq 0 ] ||
rcexec="route -T ${daemon_rtable} exec ${rcexec}"