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

Dave Reisner d at falconindy.com
Sun Apr 24 17:42:59 EDT 2011


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



More information about the arch-projects mailing list