Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Nov 2016 22:49:51 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r308786 - head/etc
Message-ID:  <201611172249.uAHMnpnF052801@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Thu Nov 17 22:49:51 2016
New Revision: 308786
URL: https://svnweb.freebsd.org/changeset/base/308786

Log:
  rc.subr: Swap checks so we only fork sysctl if *_oomprotect is set.

Modified:
  head/etc/rc.subr

Modified: head/etc/rc.subr
==============================================================================
--- head/etc/rc.subr	Thu Nov 17 21:52:00 2016	(r308785)
+++ head/etc/rc.subr	Thu Nov 17 22:49:51 2016	(r308786)
@@ -1206,22 +1206,17 @@ $command $rc_flags $command_args"
 		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)
-					case $_oomprotect in
-					[Aa][Ll][Ll])
-						${PROTECT} -i -p ${pid}
-						;;
-					[Yy][Ee][Ss])
-						${PROTECT} -p ${pid}
-						;;
-					esac
-				fi
+			if [ -n "$_oomprotect" ] && [ -f "${PROTECT}" ] &&
+			    [ "$(sysctl -n security.jail.jailed)" -eq 0 ]; then
+				pid=$(check_process $command)
+				case $_oomprotect in
+				[Aa][Ll][Ll])
+					${PROTECT} -i -p ${pid}
+					;;
+				[Yy][Ee][Ss])
+					${PROTECT} -p ${pid}
+					;;
+				esac
 			fi	
 		;;
 		esac



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611172249.uAHMnpnF052801>