We can't use protect(1) inside a jail(8)!

To avoid have warning for services that are using oomprotect, oomprotect
will only be applied on services that won't run inside jails.

Reported by:	allanjude
MFC after:	2 weeks.
This commit is contained in:
Marcelo Araujo 2016-11-10 07:05:41 +00:00
parent 9625abb359
commit 46542a426e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=308478

View File

@ -1205,6 +1205,11 @@ $command $rc_flags $command_args"
# Apply protect(1) to the PID if ${name}_oomprotect is set.
case "$rc_arg" in
start)
# We cannot use protect(1) inside jails.
jailed="$(sysctl -n security.jail.jailed)"
if [ ${jailed} -eq 1 ]; then
return $_return
fi
if [ -n "$_oomprotect" ]; then
if [ -f "${PROTECT}" ]; then
pid=$(check_process $command)