summaryrefslogtreecommitdiffstats
path: root/etc/rc.subr
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2005-12-06 05:27:11 +0000
committeryar <yar@FreeBSD.org>2005-12-06 05:27:11 +0000
commit7749f8a04f8b29d85c23f44e6a3aa26a21447e16 (patch)
treebb80227bb3d51431458943cad5eb9d693cfdd7e0 /etc/rc.subr
parent055dc8e12114d91b9d472f6f1f094db4fc8470dc (diff)
downloadFreeBSD-src-7749f8a04f8b29d85c23f44e6a3aa26a21447e16.zip
FreeBSD-src-7749f8a04f8b29d85c23f44e6a3aa26a21447e16.tar.gz
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
Diffstat (limited to 'etc/rc.subr')
-rw-r--r--etc/rc.subr12
1 files changed, 6 insertions, 6 deletions
diff --git a/etc/rc.subr b/etc/rc.subr
index cdbdd09..7678480 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
}
#
OpenPOWER on IntegriCloud