]> git.entuzijast.net Git - imunes.git/commitdiff
exit status was wrong.
authormiljenko <miljenko>
Wed, 11 Jul 2007 13:29:33 +0000 (13:29 +0000)
committermiljenko <miljenko>
Wed, 11 Jul 2007 13:29:33 +0000 (13:29 +0000)
"return" should be used instead of "exit"

Bug found by: miljenko
Submitted by:
Reviewed by:
Approved by:
Obtained from:

himage

diff --git a/himage b/himage
index 9542608cb74f8a55f2a2eff689bf6ecae65e8001..89222b33337ca77afd30efa135802c762158c261 100755 (executable)
--- 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 $*