svn commit: r308786 - head/etc

Jilles Tjoelker jilles at FreeBSD.org
Thu Nov 17 22:49:52 UTC 2016


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


More information about the svn-src-all mailing list