rc.d scripts can be missed if they aren't ordered with respect to the early-late divider

Doug Barton dougb at FreeBSD.org
Fri Apr 29 18:57:41 UTC 2011


The attached patch works, is probably cleaner than the existing code, 
and since the list of things run early is small is certainly no slower 
than the existing code. Using a space-separated list also has the 
advantage of not being limited to the format of filenames that it supports.

I'll commit it later today unless I get an objection.

-- 

	Nothin' ever doesn't change, but nothin' changes much.
			-- OK Go

	Breadth of IT experience, and depth of knowledge in the DNS.
	Yours for the right price.  :)  http://SupersetSolutions.com/

-------------- next part --------------
Index: rc
===================================================================
--- rc	(revision 221216)
+++ rc	(working copy)
@@ -84,8 +84,10 @@
 #
 files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null`
 
+_rc_elem_done=' '
 for _rc_elem in ${files}; do
 	run_rc_script ${_rc_elem} ${_boot}
+	_rc_elem_done="${_rc_elem_done}${_rc_elem} "
 
 	case "$_rc_elem" in
 	*/${early_late_divider})	break ;;
@@ -103,14 +105,9 @@
 esac
 
 files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null`
-_skip_early=1
 for _rc_elem in ${files}; do
-	case "$_skip_early" in
-	1)	case "$_rc_elem" in
-		*/${early_late_divider})	_skip_early=0 ;;
-		esac
-		continue
-		;;
+	case "$_rc_elem_done" in
+	*" $_rc_elem "*)	continue ;;
 	esac
 
 	run_rc_script ${_rc_elem} ${_boot}


More information about the freebsd-rc mailing list