Return preset error description in case of IO or header format error.
authorMilan Broz <gmazyland@gmail.com>
Mon, 22 Sep 2008 12:07:31 +0000 (12:07 +0000)
committerMilan Broz <gmazyland@gmail.com>
Mon, 22 Sep 2008 12:07:31 +0000 (12:07 +0000)
(All password related errors still return -EPERM - "No key available with this passphrase.")

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@33 36d66b0a-2a48-0410-832c-cd162a569da5

lib/setup.c

index f3b1656..1b13af6 100644 (file)
@@ -514,13 +514,14 @@ start:
        if(!password) {
                r = -EINVAL; goto out;
        }
-        
+
         r = LUKS_open_any_key(options->device, password, passwordLen, &hdr, &mk, backend);
-       if(r < 0) {
+       if (r == -EPERM)
                set_error("No key available with this passphrase.\n");
+       if (r < 0)
                goto out1;
-       } else
-                logger(options, CRYPT_LOG_NORMAL,"key slot %d unlocked.\n", r);
+
+       logger(options, CRYPT_LOG_NORMAL,"key slot %d unlocked.\n", r);
 
        
        options->offset = hdr.payloadOffset;