chiark / gitweb /
volume_id: ntfs - fix uuid setting
authorKay Sievers <kay.sievers@vrfy.org>
Tue, 3 Mar 2009 19:11:09 +0000 (20:11 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Tue, 3 Mar 2009 19:11:09 +0000 (20:11 +0100)
In my scenario, the ntfs prober did *not* detect the presence of a
ntfs filesystem (i.e. vol_id --probe-all returned *only* ext3).
However, if you examine the source of the ntfs prober, it overwrites
the uuid field of the volume_id object long before it actually
decides there's a valid filesystem there - this resulted in vol_id
returning the rather bizarre combination of type=ext3, but a uuid
populated by the ntfs prober.

https://bugs.edge.launchpad.net/ubuntu/+source/udev/+bug/337015

configure.ac
extras/volume_id/lib/ntfs.c

index e916cfca9f51e4ba91c0dd2fc4ca7c572cd45aea..5b2d9207218b132695898ed358b93099dbb158fb 100644 (file)
@@ -24,7 +24,7 @@ AC_SUBST(LIBUDEV_LT_AGE)
 
 dnl /* libvolume_id version */
 VOLID_LT_CURRENT=1
-VOLID_LT_REVISION=9
+VOLID_LT_REVISION=10
 VOLID_LT_AGE=0
 AC_SUBST(VOLID_LT_CURRENT)
 AC_SUBST(VOLID_LT_REVISION)
index b322c77dbd30b77df4e38ad9d1e1ec6fc09b400b..f727634094916c08e1d831eb4653c35ff2b82976 100644 (file)
@@ -97,6 +97,7 @@ static struct volume_info {
 
 int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size)
 {
+       uint8_t volume_serial[8];
        unsigned int sector_size;
        unsigned int cluster_size;
        uint64_t mft_cluster;
@@ -119,7 +120,7 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size)
        if (memcmp(ns->oem_id, "NTFS", 4) != 0)
                return -1;
 
-       volume_id_set_uuid(id, ns->volume_serial, 0, UUID_64BIT_LE);
+       memcpy(volume_serial, ns->volume_serial, sizeof(volume_serial));
 
        sector_size = le16_to_cpu(ns->bytes_per_sector);
        if (sector_size < 0x200)
@@ -193,6 +194,7 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size)
                }
        }
 
+       volume_id_set_uuid(id, volume_serial, 0, UUID_64BIT_LE);
        volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
        id->type = "ntfs";
        /* we think this is ntfs, but we make sure no other signatures are found */