From: Karel Zak Date: Wed, 11 Sep 2013 15:42:48 +0000 (+0200) Subject: libblkid: export info about bad csum X-Git-Tag: v2.24-rc1~275 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d88803a4ad1b4797180ce07ce00c7b879c66dd55;p=thirdparty%2Futil-linux.git libblkid: export info about bad csum 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 --- diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c index 29223a664d..4b0c997961 100644 --- a/libblkid/src/probe.c +++ b/libblkid/src/probe.c @@ -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; } /**