]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: atari - don't add duplicate entries
authorVaclav Dolezal <vdolezal@redhat.com>
Wed, 24 Jan 2018 12:52:49 +0000 (13:52 +0100)
committerVaclav Dolezal <vdolezal@redhat.com>
Wed, 24 Jan 2018 13:40:21 +0000 (14:40 +0100)
This should protect against looped XGMs.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
libblkid/src/partitions/atari.c

index 1ec17d486c6589fcbba6e176f25a5161b0190e2e..432df20254792b96a50fcb1329367a8e47e5fb24 100644 (file)
@@ -107,6 +107,13 @@ static int parse_partition(blkid_partlist ls, blkid_parttable tab,
        start = be32_to_cpu(part->start) + offset;
        size = be32_to_cpu(part->size);
 
+       if (blkid_partlist_get_partition_by_start(ls, start)) {
+               /* Don't increment partno for extended parts */
+               if (!offset)
+                       blkid_partlist_increment_partno(ls);
+               return 0;
+       }
+
        par = blkid_partlist_add_partition(ls, tab, start, size);
        if (!par)
                return -ENOMEM;
@@ -151,7 +158,7 @@ static int parse_extended(blkid_probe pr, blkid_partlist ls,
                        return 0;
 
                rc = parse_partition(ls, tab, &xrs->part[i], xstart);
-               if (rc < 0)
+               if (rc <= 0)
                        return rc;
 
                if (!IS_ACTIVE(xrs->part[i+1]))