From fd9791c1ea0496918f25535f1f90ffe9ba32b106 Mon Sep 17 00:00:00 2001 From: Yaroslav Tykhiy Date: Wed, 16 Nov 2005 10:45:19 +0000 Subject: [PATCH] Avoid invoking the current script again when we need to issue sub-commands, e.g., restart = stop + start. By calling run_rc_command instead, we provide rc.d scripts with full control over their configuration variables. For an example problem the former approach caused, see http://lists.freebsd.org/pipermail/freebsd-rc/2005-October/000311.html Reviewed by: freebsd-rc Tested by: Dirk Engling erdgeist erdgeist.org MFC after: 2 weeks --- etc/rc.subr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/rc.subr b/etc/rc.subr index 4ed122a2e197..ff88433c5e58 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -770,8 +770,9 @@ $command $rc_flags $command_args" 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