]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: make sure libblkid uses the same sector size
authorKarel Zak <kzak@redhat.com>
Mon, 14 Oct 2024 09:45:32 +0000 (11:45 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 14 Oct 2024 09:45:32 +0000 (11:45 +0200)
Libfdisk uses libblkid to check for filesystems on the device. It
makes sense for both libraries to share the logical sector size
setting, as this setting can be modified by using the fdisk command
line.

We do not see this as an issue, as filesystem detection rarely depends
on sector size (with the exception of some RAIDs). Additionally,
libblkid is usually intelligent enough to check multiple locations
independently of the current device's sector size setting.

Addresses: https://github.com/util-linux/util-linux/pull/3235
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/wipe.c

index bb5f1bb38bf6e7c5ac1c90a8aedfaebc130de6ad..f389ed4194a03cb8186c7f1697d18ba05a4e6421 100644 (file)
@@ -133,6 +133,7 @@ int fdisk_do_wipe(struct fdisk_context *cxt)
                        DBG(WIPE, ul_debugobj(wp, "blkid_probe_set_device() failed [rc=%d]", rc));
                        return rc;
                }
+               blkid_probe_set_sectorsize(pr, cxt->sector_size);
 
                DBG(WIPE, ul_debugobj(wp, " wiping..."));
                blkid_wipe_all(pr);
@@ -176,6 +177,8 @@ int fdisk_check_collisions(struct fdisk_context *cxt)
        free(cxt->collision);
        cxt->collision = NULL;
 
+       blkid_probe_set_sectorsize(pr, cxt->sector_size);
+
        blkid_probe_enable_superblocks(pr, 1);
        blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_TYPE |
                                              BLKID_SUBLKS_BADCSUM);