[kexec-tools] shell exit value fix

Dave Young yangrr at fedoraproject.org
Thu Jul 12 03:20:33 UTC 2012


commit e444daa5ace806406e26315f1d2acdfa6f69762c
Author: Dave Young <dyoung at redhat.com>
Date:   Thu Jul 12 11:15:35 2012 +0800

    shell exit value fix
    
    exit the saved $? instead of the wrong one after echo line
    v1->v2: vivek, save the return value instead of exit 1
    
    Signed-off-by: Dave Young <dyoung at redhat.com>
    Acked-by: Vivek Goyal <vgoyal at redhat.com>

 kdumpctl |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/kdumpctl b/kdumpctl
index e1c7f8c..54c1cdf 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -242,12 +242,13 @@ function check_ssh_config()
 
 function check_ssh_target()
 {
+    local _ret
     ssh -q -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH
-    if [ $? -ne 0 ]; then
+    _ret=$?
+    if [ $_ret -ne 0 ]; then
         echo "Could not create $DUMP_TARGET:$SAVE_PATH, you probably need to run \"service kdump propagate\""
-        exit $?
+        exit $_ret
     fi
-    return 0
 }
 
 function propagate_ssh_key()


More information about the scm-commits mailing list