From: Karel Zak Date: Fri, 28 Mar 2014 14:07:17 +0000 (+0100) Subject: libblkid: fix partitions probing X-Git-Tag: v2.25-rc1~396 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5b575d4381591d2744aafb957e149e88739921d2;p=thirdparty%2Futil-linux.git libblkid: fix partitions probing * 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 --- diff --git a/libblkid/src/partitions/dos.c b/libblkid/src/partitions/dos.c index 71c9bc85eb..2539908002 100644 --- a/libblkid/src/partitions/dos.c +++ b/libblkid/src/partitions/dos.c @@ -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; } diff --git a/libblkid/src/partitions/minix.c b/libblkid/src/partitions/minix.c index 6c6cb6b167..43c9d9af10 100644 --- a/libblkid/src/partitions/minix.c +++ b/libblkid/src/partitions/minix.c @@ -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; diff --git a/libblkid/src/partitions/partitions.c b/libblkid/src/partitions/partitions.c index abc7dac4e9..003ca9e4d1 100644 --- a/libblkid/src/partitions/partitions.c +++ b/libblkid/src/partitions/partitions.c @@ -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; diff --git a/libblkid/src/superblocks/vfat.c b/libblkid/src/superblocks/vfat.c index 716a5ae6b4..f38deac8b2 100644 --- a/libblkid/src/superblocks/vfat.c +++ b/libblkid/src/superblocks/vfat.c @@ -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);