diff options
author | yar <yar@FreeBSD.org> | 2006-07-25 17:20:22 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2006-07-25 17:20:22 +0000 |
commit | 01293392f343479e4ddf00daf7bcb1e5b6a9867f (patch) | |
tree | 99dac5c1c6dcf5c235ceb4401c87fc51ceb63e74 /etc | |
parent | 8b60fade6cf1941b03cb024e755dffdc4f641687 (diff) | |
download | FreeBSD-src-01293392f343479e4ddf00daf7bcb1e5b6a9867f.zip FreeBSD-src-01293392f343479e4ddf00daf7bcb1e5b6a9867f.tar.gz |
Avoid extra runs of test(1) by using its built-in logical operations.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc.subr | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/etc/rc.subr b/etc/rc.subr index f89c699..335f6e9 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -575,16 +575,14 @@ run_rc_command() debug "run_rc_command: evaluating ${_precmd}()." eval $_precmd $rc_extra_args _return=$? - [ $_return -ne 0 ] && [ -z "$rc_force" ] && - return 1 + [ $_return -ne 0 -a -z "$rc_force" ] && return 1 fi if [ -n "$_cmd" ]; then debug "run_rc_command: evaluating ${_cmd}()." eval $_cmd $rc_extra_args _return=$? - [ $_return -ne 0 ] && [ -z "$rc_force" ] && - return 1 + [ $_return -ne 0 -a -z "$rc_force" ] && return 1 fi if [ -n "$_postcmd" ]; then @@ -652,8 +650,7 @@ run_rc_command() debug "run_rc_command: evaluating ${_precmd}()." eval $_precmd _return=$? - [ $_return -ne 0 ] && [ -z "$rc_force" ] && - return 1 + [ $_return -ne 0 -a -z "$rc_force" ] && return 1 fi # setup the full command to run @@ -681,7 +678,7 @@ $command $rc_flags $command_args" debug "run_rc_command: _doit: $_doit" eval $_doit _return=$? - [ $_return -ne 0 ] && [ -z "$rc_force" ] && return 1 + [ $_return -ne 0 -a -z "$rc_force" ] && return 1 # finally, run postcmd # @@ -709,8 +706,7 @@ $command $rc_flags $command_args" if [ -n "$_precmd" ]; then eval $_precmd _return=$? - [ $_return -ne 0 ] && [ -z "$rc_force" ] && - return 1 + [ $_return -ne 0 -a -z "$rc_force" ] && return 1 fi # send the signal to stop @@ -726,7 +722,7 @@ $command $rc_flags $command_args" # eval $_doit _return=$? - [ $_return -ne 0 ] && [ -z "$rc_force" ] && return 1 + [ $_return -ne 0 -a -z "$rc_force" ] && return 1 # wait for the command to exit, # and run postcmd. @@ -751,8 +747,7 @@ $command $rc_flags $command_args" if [ -n "$_precmd" ]; then eval $_precmd _return=$? - [ $_return -ne 0 ] && [ -z "$rc_force" ] && - return 1 + [ $_return -ne 0 -a -z "$rc_force" ] && return 1 fi _doit="kill -${sig_reload:-HUP} $rc_pid" if [ -n "$_user" ]; then @@ -760,7 +755,7 @@ $command $rc_flags $command_args" fi eval $_doit _return=$? - [ $_return -ne 0 ] && [ -z "$rc_force" ] && return 1 + [ $_return -ne 0 -a -z "$rc_force" ] && return 1 if [ -n "$_postcmd" ]; then eval $_postcmd _return=$? @@ -771,8 +766,7 @@ $command $rc_flags $command_args" if [ -n "$_precmd" ]; then eval $_precmd $rc_extra_args _return=$? - [ $_return -ne 0 ] && [ -z "$rc_force" ] && - return 1 + [ $_return -ne 0 -a -z "$rc_force" ] && return 1 fi # prevent restart being called more # than once by any given script |