From: Karel Zak Date: Mon, 14 Oct 2024 09:45:32 +0000 (+0200) Subject: libfdisk: make sure libblkid uses the same sector size X-Git-Tag: v2.42-start~180 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7ada6547fcd1f649fadaa8021ff21e3e0f431459;p=thirdparty%2Futil-linux.git libfdisk: make sure libblkid uses the same sector size 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 --- diff --git a/libfdisk/src/wipe.c b/libfdisk/src/wipe.c index bb5f1bb38..f389ed419 100644 --- a/libfdisk/src/wipe.c +++ b/libfdisk/src/wipe.c @@ -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);