[arch-projects] [initscripts][PATCH] rc: exit with error count, not error sum

Seblu seblu at seblu.net
Sun Apr 24 18:07:07 EDT 2011


On Sun, Apr 24, 2011 at 11:42 PM, Dave Reisner <d at falconindy.com> wrote:
> cc199761f assumes that /etc/rc.d scripts will exit with a value of 0 or
> 1. Since this can't be guaranteed, clamp the return value to 0 or 1
> before adding it to the exit value.
> ---
>  rc |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/rc b/rc
> index 1e64119..54dc11c 100755
> --- a/rc
> +++ b/rc
> @@ -45,7 +45,7 @@ case $1 in
>                shift
>                for i; do
>                        [[ -x "/etc/rc.d/$i" ]] && "/etc/rc.d/$i" $action
> -                       (( ret += $? ))
> +                       (( ret += !! $? ))  # clamp exit value to 0/1
>                done

why doen't increment ret each time a non zero value is detected? This
is simpler no?

(($?)) || ((ret++) ?



-- 
Sébastien Luttringer
www.seblu.net


More information about the arch-projects mailing list