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@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
Dave Young 2012-07-12 11:15:35 +08:00
parent 2e730e047e
commit e444daa5ac

View File

@ -242,12 +242,13 @@ function check_ssh_config()
function check_ssh_target() function check_ssh_target()
{ {
local _ret
ssh -q -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH 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\"" echo "Could not create $DUMP_TARGET:$SAVE_PATH, you probably need to run \"service kdump propagate\""
exit $? exit $_ret
fi fi
return 0
} }
function propagate_ssh_key() function propagate_ssh_key()