summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2011-04-09 15:39:22 +0000
committerschwarze <schwarze@openbsd.org>2011-04-09 15:39:22 +0000
commit64cd97fa12a7e3b370366bdf578afc418366dae8 (patch)
tree9244fef49d2226c54cf9cec2404bb25967a798f0
parentMore NULL -> 0 fallout. (diff)
downloadwireguard-openbsd-64cd97fa12a7e3b370366bdf578afc418366dae8.tar.xz
wireguard-openbsd-64cd97fa12a7e3b370366bdf578afc418366dae8.zip
Fix multiple issues and make the code simpler and more robust:
- As noticed by ajacoutot@, re_format(7) does not treat '\t' as a tab, so some t's got stripped from daemon names. - The tr(1) failed to sanitize mixtures of blanks and tabs. 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 24a2a0c6343..373ce99fa73 100644
--- a/etc/rc.d/rc.subr
+++ b/etc/rc.d/rc.subr
@@ -1,4 +1,4 @@
-# $OpenBSD: rc.subr,v 1.34 2011/04/06 17:10:38 robert Exp $
+# $OpenBSD: rc.subr,v 1.35 2011/04/09 15:39:22 schwarze Exp $
# Default functions and variables used by rc.d(8) scripts.
@@ -117,6 +117,7 @@ getcap -f /etc/login.conf ${_name} 1>/dev/null 2>&1 && \
[ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
[ -n "${_rcuser}" ] && daemon_user=${_rcuser}
-daemon_flags=$(printf '%s\n' "${daemon_flags}" | tr -s "[:space:]" | sed 's/^[ \t]*//;s/[ \t]*$//')
+daemon_flags=$(printf ' %s' ${daemon_flags})
+daemon_flags=${daemon_flags## }
pexp="${daemon}${daemon_flags:+ ${daemon_flags}}"
rcexec="su -l -c ${daemon_class} -s /bin/sh ${daemon_user} -c"