A fix for `restart'

Yar Tikhiy yar at comp.chem.msu.su
Tue Oct 25 22:10:37 PDT 2005


Folks,

Would you mind testing the following patch to /etc/rc.subr
that should remedy problems with `restart', e.g., as found
for /etc/rc.d/jail?  It is safe as it doesn't affect other
commans and hence it won't disrupt your boot sequence :-)
I'm just concerned about possible side-effects for restart
I might have overlooked.  The test case of scripts taking
additional arguments besides the command is the most intriguing.

----- Begin patch -----

--- //depot/user/yar/hack/etc/rc.subr	2005/10/26 04:02:40
+++ //depot/user/yar/hack/etc/rc.subr	2005/10/26 04:57:21
@@ -770,8 +770,9 @@
 			fi
 			_rc_restart_done=true
 
-			( $0 ${_rc_prefix}stop $rc_extra_args )
-			$0 ${_rc_prefix}start $rc_extra_args
+			# run stop in a subshell to keep variables for start
+			( run_rc_command ${_rc_prefix}stop $rc_extra_args )
+			run_rc_command ${_rc_prefix}start $rc_extra_args
 
 			if [ -n "$_postcmd" ]; then
 				eval $_postcmd $rc_extra_args

----- End patch -----

-- 
Yar


More information about the freebsd-rc mailing list