Fix return code for status command when device doesn't exists.
authorMilan Broz <gmazyland@gmail.com>
Mon, 13 Jun 2011 16:44:42 +0000 (16:44 +0000)
committerMilan Broz <gmazyland@gmail.com>
Mon, 13 Jun 2011 16:44:42 +0000 (16:44 +0000)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@550 36d66b0a-2a48-0410-832c-cd162a569da5

ChangeLog
src/cryptsetup.c
tests/compat-test

index ffdd58c..124dbec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2011-06-08  Milan Broz  <mbroz@redhat.com>
+       * Fix return code for status command when device doesn't exists.
+
 2011-05-24  Milan Broz  <mbroz@redhat.com>
        * Version 1.3.1.
 
index 1faba4b..41c4692 100644 (file)
@@ -370,6 +370,7 @@ static int action_status(int arg __attribute__((unused)))
                break;
        case CRYPT_INACTIVE:
                log_std("%s/%s is inactive.\n", crypt_get_dir(), action_argv[0]);
+               r = -ENODEV;
                break;
        case CRYPT_ACTIVE:
        case CRYPT_BUSY:
index 43bb639..fdd8e49 100755 (executable)
@@ -255,6 +255,7 @@ $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "100 sectors" || fail
 $CRYPTSETUP -q resize  $DEV_NAME || fail
 $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "19997 sectors" || fail
 $CRYPTSETUP -q remove  $DEV_NAME || fail
+$CRYPTSETUP -q status  $DEV_NAME >/dev/null && fail
 echo "key0" | $CRYPTSETUP create $DEV_NAME --hash sha1 $LOOPDEV || fail
 $CRYPTSETUP -q remove  $DEV_NAME || fail
 echo "key0" | $CRYPTSETUP -q create $DEV_NAME --hash sha1 $LOOPDEV || fail