]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: fix partitions probing
authorKarel Zak <kzak@redhat.com>
Fri, 28 Mar 2014 14:07:17 +0000 (15:07 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 28 Mar 2014 14:07:17 +0000 (15:07 +0100)
 * PART_ENTRY_* stuff is optional and should not overwrite
   previous probing result in partitions_probe()

 * missing minix parental partition is not error

 * blkid_probe_is_vfat() usage has to be more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/partitions/dos.c
libblkid/src/partitions/minix.c
libblkid/src/partitions/partitions.c
libblkid/src/superblocks/vfat.c

index 71c9bc85ebc3a3e7f7c1f5f709e575a7fe7da942..25399080020a4d47fd969bd3edecaf1e7f7b9d4e 100644 (file)
@@ -158,7 +158,7 @@ static int probe_dos_pt(blkid_probe pr,
         * either the boot sector of a FAT filesystem or a DOS-type
         * partition table.
         */
-       if (blkid_probe_is_vfat(pr)) {
+       if (blkid_probe_is_vfat(pr) == 1) {
                DBG(LOWPROBE, ul_debug("probably FAT -- ignore"));
                goto nothing;
        }
index 6c6cb6b1670778911f74befb443977118d995937..43c9d9af10e5f3c95b2a2053640466b7d5661e18 100644 (file)
@@ -40,7 +40,7 @@ static int probe_minix_pt(blkid_probe pr,
         */
        parent = blkid_partlist_get_parent(ls);
        if (!parent)
-               goto err;
+               goto nothing;
 
        if (blkid_partition_get_type(parent) != MBR_MINIX_PARTITION)
                goto nothing;
index abc7dac4e91c33c932c54bf16e214c2ee2be06a6..003ca9e4d1b391028bb2b8592e3b8c135bb42f5f 100644 (file)
@@ -634,10 +634,12 @@ details_only:
        /*
         * Gather PART_ENTRY_* values if the current device is a partition.
         */
-       if (rc == BLKID_PROBE_OK && !chn->binary &&
+       if ((rc == BLKID_PROBE_OK || rc == BLKID_PROBE_NONE) && !chn->binary &&
            (blkid_partitions_get_flags(pr) & BLKID_PARTS_ENTRY_DETAILS)) {
 
-               rc = blkid_partitions_probe_partition(pr);
+               int xrc = blkid_partitions_probe_partition(pr);
+               if (xrc < 0)
+                       rc = xrc;       /* optional, care about errors only */
        }
 
        return rc;
index 716a5ae6b45615b53ac44966b4f157fd94523d52..f38deac8b24c4578eef3a15784156b4311258f18 100644 (file)
@@ -255,8 +255,12 @@ int blkid_probe_is_vfat(blkid_probe pr)
        struct vfat_super_block *vs;
        struct msdos_super_block *ms;
        const struct blkid_idmag *mag = NULL;
+       int rc;
 
-       if (blkid_probe_get_idmag(pr, &vfat_idinfo, NULL, &mag) || !mag)
+       rc = blkid_probe_get_idmag(pr, &vfat_idinfo, NULL, &mag);
+       if (rc < 0)
+               return rc;      /* error */
+       if (rc != BLKID_PROBE_OK || !mag)
                return 0;
 
        ms = blkid_probe_get_sb(pr, mag, struct msdos_super_block);