]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: export info about bad csum
authorKarel Zak <kzak@redhat.com>
Wed, 11 Sep 2013 15:42:48 +0000 (17:42 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 11 Sep 2013 15:42:48 +0000 (17:42 +0200)
If a bad check sum is detected and BLKID_SUBLKS_BADCSUM is enabled
than SBBADCSUM=1 is added to the probing result.

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/probe.c

index 29223a664db0a5ae5e48bda270e545dda46c0819..4b0c997961bf51444fbea3dec7600efd88e73601 100644 (file)
@@ -1361,12 +1361,19 @@ int blkid_probe_verify_csum(blkid_probe pr, uint64_t csum, uint64_t expected)
                                " got %jX, expected %jX",
                                blkid_probe_get_probername(pr),
                                csum, expected));
-
-               if (!(chn->flags & BLKID_SUBLKS_BADCSUM))
-                       return 0;
+               /*
+                * Accept bad checksum if BLKID_SUBLKS_BADCSUM flags is set
+                */
+               if (chn->driver->id == BLKID_CHAIN_SUBLKS
+                   && (chn->flags & BLKID_SUBLKS_BADCSUM)) {
+                       blkid_probe_set_value(pr, "SBBADCSUM", (unsigned char *) "1", 2);
+                       goto accept;
+               }
+               return 0;       /* bad checksum */
        }
 
-       return 1;       /* checksum accepted */
+accept:
+       return 1;
 }
 
 /**