From 0ce3dc049a842f2e2f1d1400b9f8b191912ab635 Mon Sep 17 00:00:00 2001 From: Yaroslav Tykhiy Date: Tue, 6 Dec 2005 05:27:11 +0000 Subject: [PATCH] Since rc.subr is a library of functions, it should not use exit every now and then. It is up to the caller to choose a proper action upon an error condition. Therefore, use return, not exit, except for some special cases. Consistently return 1 to indicate an error. Submitted by: sem (initially) Reviewed by: freebsd-rc (silence) MFC after: 2 weeks --- etc/rc.subr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/etc/rc.subr b/etc/rc.subr index cdbdd09646be..76784803c3a6 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -598,12 +598,12 @@ run_rc_command() start) if [ -z "$rc_fast" -a -n "$rc_pid" ]; then echo "${name} already running? (pid=$rc_pid)." - exit 1 + return 1 fi if [ ! -x ${_chroot}${command} ]; then info "run_rc_command: cannot run ($command)." - return 0 + return 1 fi # check for required variables, @@ -681,14 +681,14 @@ $command $rc_flags $command_args" stop) if [ -z "$rc_pid" ]; then - [ -n "$rc_fast" ] && exit 0 + [ -n "$rc_fast" ] && return 0 if [ -n "$pidfile" ]; then echo \ "${name} not running? (check $pidfile)." else echo "${name} not running?" fi - exit 1 + return 1 fi # if the precmd failed and force @@ -733,7 +733,7 @@ $command $rc_flags $command_args" else echo "${name} not running?" fi - exit 1 + return 1 fi echo "Reloading ${name} config files." if [ -n "$_precmd" ]; then @@ -807,7 +807,7 @@ $command $rc_flags $command_args" echo 1>&2 "$0: unknown directive '$rc_arg'." rc_usage $_keywords - exit 1 + # not reached } #