summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2017-10-25 10:42:51 +0000
committerbluhm <bluhm@openbsd.org>2017-10-25 10:42:51 +0000
commit9017c8e1b23cad537122b7dba6f873a8a56a735c (patch)
treeb401d08b8effac7f1165f3ad9b85bf1781a929eb
parentCheck for NULL before dereferencing untrusted pointers. (diff)
downloadwireguard-openbsd-9017c8e1b23cad537122b7dba6f873a8a56a735c.tar.xz
wireguard-openbsd-9017c8e1b23cad537122b7dba6f873a8a56a735c.zip
Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process limits affect the daemons started during boot. OK rpe@ halex@
-rw-r--r--etc/rc18
1 files changed, 11 insertions, 7 deletions
diff --git a/etc/rc b/etc/rc
index a0c1d7322a5..3d4f219e1ca 100644
--- a/etc/rc
+++ b/etc/rc
@@ -1,4 +1,4 @@
-# $OpenBSD: rc,v 1.519 2017/10/12 18:14:05 rpe Exp $
+# $OpenBSD: rc,v 1.520 2017/10/25 10:42:51 bluhm Exp $
# System startup script run by init on autoboot or after single-user.
# Output and error are redirected to console by init, and the console is the
@@ -49,16 +49,20 @@ update_limit() {
# Apply sysctl.conf(5) settings.
sysctl_conf() {
- stripcom /etc/sysctl.conf |
- while read _line; do
- sysctl "$_line"
+ # do not use a pipe as limits would only be applied to the subshell
+ set -- $(stripcom /etc/sysctl.conf)
+ while [[ $# > 0 ]] ; do
+ sysctl "$1"
- case $_line in
+ case "$1" in
kern.maxproc=*)
- update_limit -p maxproc;;
+ update_limit -p maxproc
+ ;;
kern.maxfiles=*)
- update_limit -n openfiles;;
+ update_limit -n openfiles
+ ;;
esac
+ shift
done
}