diff options
author | yar <yar@FreeBSD.org> | 2005-11-16 10:45:19 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2005-11-16 10:45:19 +0000 |
commit | 962b5dc651c0176ea64489a30433a898f4daf4d1 (patch) | |
tree | 92364a2c1c1125914525b242b7ad543631800e1b | |
parent | 2f35b6aa00d5b756cf4345ade163c222bdde6a6b (diff) | |
download | FreeBSD-src-962b5dc651c0176ea64489a30433a898f4daf4d1.zip FreeBSD-src-962b5dc651c0176ea64489a30433a898f4daf4d1.tar.gz |
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 <at> erdgeist.org
MFC after: 2 weeks
-rw-r--r-- | etc/rc.subr | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/etc/rc.subr b/etc/rc.subr index 4ed122a..ff88433 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 |