From: miljenko Date: Wed, 11 Jul 2007 13:29:33 +0000 (+0000) Subject: exit status was wrong. X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=4197c670bbeb0bd80fa53b1da7bce9289a7bdda7;p=imunes.git exit status was wrong. "return" should be used instead of "exit" Bug found by: miljenko Submitted by: Reviewed by: Approved by: Obtained from: --- diff --git a/himage b/himage index 9542608..89222b3 100755 --- a/himage +++ b/himage @@ -24,7 +24,7 @@ vi_name() { if test a$imagename != "a"; then echo "Error: $hname is not a unique name." >&2 echo "It is used for nodes $imagename and $image (at least)." >&2 - exit 1 + return 1 fi imagename=$image fi @@ -33,7 +33,7 @@ vi_name() { echo $imagename else echo Error: cannot find node named $1 >&2 - exit 2 + return 2 fi } @@ -47,26 +47,29 @@ elif test $1 = "-m" || test $1 = "-d" || test $1 = "-i"; then hname=$2 shift 2 image_name=`vi_name $hname` - if [ $? -ne 0 ]; then - exit + stat=$? + if [ $stat -ne 0 ]; then + exit $stat fi exec vimage $opt $image_name $* elif test $1 = "-l"; then if test $# -eq 2; then hname=$2 image_name=`vi_name $hname` - if [ $? -ne 0 ]; then - exit + stat=$? + if [ $stat -ne 0 ]; then + exit $stat fi exec vimage -l $image_name else exec vimage -l fi -elif test $1 != "-.*"; then +else hname=$1 image_name=`vi_name $hname` - if [ $? -ne 0 ]; then - exit + stat=$? + if [ $stat -ne 0 ]; then + exit $stat fi shift 1 exec vimage $image_name $*