Fix displaying of error messages for mising kernel features.
authorMilan Broz <gmazyland@gmail.com>
Tue, 8 Jan 2013 13:19:31 +0000 (14:19 +0100)
committerMilan Broz <gmazyland@gmail.com>
Tue, 8 Jan 2013 13:19:31 +0000 (14:19 +0100)
lib/loopaes/loopaes.c
lib/tcrypt/tcrypt.c
lib/verity/verity.c
tests/verity-compat-test

index ab61ca3..6ad965c 100644 (file)
@@ -228,7 +228,7 @@ int LOOPAES_activate(struct crypt_device *cd,
 
        r = dm_create_device(cd, name, CRYPT_LOOPAES, &dmd, 0);
 
-       if (!r && !(dm_flags() & req_flags)) {
+       if (r < 0 && !(dm_flags() & req_flags)) {
                log_err(cd, _("Kernel doesn't support loop-AES compatible mapping.\n"));
                r = -ENOTSUP;
        }
index eb1e2da..239d3c7 100644 (file)
@@ -716,7 +716,7 @@ int TCRYPT_activate(struct crypt_device *cd,
                        break;
        }
 
-       if (!r && !(dm_flags() & DM_PLAIN64_SUPPORTED)) {
+       if (r < 0 && !(dm_flags() & DM_PLAIN64_SUPPORTED)) {
                log_err(cd, _("Kernel doesn't support plain64 IV.\n"));
                r = -ENOTSUP;
        }
index e3285a2..c2b8405 100644 (file)
@@ -272,7 +272,7 @@ int VERITY_activate(struct crypt_device *cd,
                return r;
 
        r = dm_create_device(cd, name, CRYPT_VERITY, &dmd, 0);
-       if (!r && !(dm_flags() & DM_VERITY_SUPPORTED)) {
+       if (r < 0 && !(dm_flags() & DM_VERITY_SUPPORTED)) {
                log_err(cd, _("Kernel doesn't support dm-verity mapping.\n"));
                return -ENOTSUP;
        }
index b39dcf8..e9c1101 100755 (executable)
@@ -149,6 +149,7 @@ function valgrind_run()
 
 [ -n "$VALG" ] && valgrind_setup && VERITYSETUP=valgrind_run
 modprobe dm-verity >/dev/null 2>&1
+dmsetup targets | grep verity >/dev/null 2>&1 || skip "Cannot find dm-verity target, test skipped."
 
 # VERITYSETUP tests