summaryrefslogtreecommitdiffstats
path: root/libblkid
diff options
context:
space:
mode:
authorPali Rohár2017-11-20 18:16:59 +0100
committerPali Rohár2017-11-20 18:16:59 +0100
commit3999e62a72f46d525ee4cc10b18781468ace9b9c (patch)
tree6c7c73c415f665e5ea10a80968057b5cec0531ec /libblkid
parentMerge branch 'master' of https://github.com/pali/util-linux (diff)
downloadkernel-qcow2-util-linux-3999e62a72f46d525ee4cc10b18781468ace9b9c.tar.gz
kernel-qcow2-util-linux-3999e62a72f46d525ee4cc10b18781468ace9b9c.tar.xz
kernel-qcow2-util-linux-3999e62a72f46d525ee4cc10b18781468ace9b9c.zip
libblkid: udf: Fix parsing UDF revision
UDF revision is stored as decimal number in hexadecimal format. E.g. number 0x0150 is revision 1.50, number 0x0201 is revision 2.01. Apparently all UDF test images have number which has same representation in decimal and hexadecimal format, so problem was not detected. This patch adds new test image with UDF revision 1.50. Internally number is stored as 0x0150. In decimal format it is (incorrectly) 1.80, but in hexadecimal correct 1.50. $ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-8.img bs=1M count=10 $ mkudffs -r 0x150 -b 512 udf-hdd-mkudffs-1.3-8.img Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Diffstat (limited to 'libblkid')
-rw-r--r--libblkid/src/superblocks/udf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libblkid/src/superblocks/udf.c b/libblkid/src/superblocks/udf.c
index 756fbcf63..bd8e0a5c2 100644
--- a/libblkid/src/superblocks/udf.c
+++ b/libblkid/src/superblocks/udf.c
@@ -450,7 +450,9 @@ real_blksz:
}
if (udf_rev)
- blkid_probe_sprintf_version(pr, "%d.%02d", (int)(udf_rev >> 8), (int)(udf_rev & 0xFF));
+ /* UDF revision is stored as decimal number in hexadecimal format.
+ * E.g. number 0x0150 is revision 1.50, number 0x0201 is revision 2.01. */
+ blkid_probe_sprintf_version(pr, "%x.%02x", (unsigned int)(udf_rev >> 8), (unsigned int)(udf_rev & 0xFF));
return 0;
}