[arch-projects] [initscripts][PATCH] rc: exit with error count, not error sum
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 esac -- 1.7.4.4
On Sun, Apr 24, 2011 at 11:42 PM, Dave Reisner <d@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.
Do you have a public repo I could pull from? (GMail always messes up the patches, even if I ask for the original message). -t
On Sun, Apr 24, 2011 at 11:57:59PM +0200, Tom Gundersen wrote:
On Sun, Apr 24, 2011 at 11:42 PM, Dave Reisner <d@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.
Do you have a public repo I could pull from? (GMail always messes up the patches, even if I ask for the original message).
-t
Surely. I'll start using my working branch on Github again. d
On Mon, Apr 25, 2011 at 12:09 AM, Dave Reisner <d@falconindy.com> wrote:
Surely. I'll start using my working branch on Github again.
Thanks for this! I pulled your patch from there (the iproute2 stuff looks promising!). Cheers, -t
On Sun, Apr 24, 2011 at 11:42 PM, Dave Reisner <d@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
On Mon, Apr 25, 2011 at 12:07:07AM +0200, Seblu wrote:
On Sun, Apr 24, 2011 at 11:42 PM, Dave Reisner <d@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++) ?
Well, it'd be && instead of ||, but this is the first thing that came to mine (using an old C idiom). It's 6 of one, a half dozen of another. Also, I just noticed that this increments the exit value when the [[ -x check fails, but I think I'm okay with that. d
participants (3)
-
Dave Reisner
-
Seblu
-
Tom Gundersen