aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-06-17 23:13:14 -0400
committerWilliam Hubbs <williamh@gentoo.org>2011-06-18 10:06:41 -0500
commit8947c00204e771a669433708de7aa740dca9d16c (patch)
tree3fb3b323b9dd44ce6c3423c16996dca3abe92cb8
parent4eb37f67cf1edbece52b5617cb763bbd899ab385 (diff)
sysctl: do not make unknown keys fatal
If unknown keys are found, currently sysctl would add all of its valid settings, but then leave itself marked as "stopped". Since this is not really what we want, make unknown keys a non-fatal error. Reported-by: Christian Ruppert <idl0r@gentoo.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--init.d/sysctl.Linux.in15
1 files changed, 12 insertions, 3 deletions
diff --git a/init.d/sysctl.Linux.in b/init.d/sysctl.Linux.in
index 83e75368..19b4942a 100644
--- a/init.d/sysctl.Linux.in
+++ b/init.d/sysctl.Linux.in
@@ -10,16 +10,25 @@ depend()
start()
{
- local conf= retval=0
+ local conf= retval=0 err errs
+
ebegin "Configuring kernel parameters"
eindent
+
for conf in /etc/sysctl.d/*.conf /etc/sysctl.conf; do
if [ -r "$conf" ]; then
vebegin "applying $conf"
- sysctl -p "$conf" >/dev/null
+ if ! err=$(sysctl -q -p "$conf" 2>&1) ; then
+ errs="${errs} ${err}"
+ sysctl -q -e -p "${conf}"
+ fi
veend $? || retval=1
fi
done
+
eoutdent
- eend $retval "Some errors were encountered"
+ if [ ${retval} -eq 0 ] && [ -n "${errs}" ] ; then
+ ewarn "Unknown keys:${errs}"
+ fi
+ eend $retval "Some errors were encountered: ${errs}"
}