summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/context.c
diff options
context:
space:
mode:
authorKarel Zak2017-02-10 16:45:18 +0100
committerKarel Zak2017-02-10 16:45:18 +0100
commitbd3457b8d956911167fe8739c220ad2dff6366a8 (patch)
tree3019b664838345b1eec05051fa5caad89d29f65e /libfdisk/src/context.c
parentsfdisk: --quiet fixes (diff)
downloadkernel-qcow2-util-linux-bd3457b8d956911167fe8739c220ad2dff6366a8.tar.gz
kernel-qcow2-util-linux-bd3457b8d956911167fe8739c220ad2dff6366a8.tar.xz
kernel-qcow2-util-linux-bd3457b8d956911167fe8739c220ad2dff6366a8.zip
libfdisk: fix fdisk_set_wipe_area() calls
The function expects size in sectors rather than in bytes. Addresses: https://github.com/karelzak/util-linux/issues/410 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/context.c')
-rw-r--r--libfdisk/src/context.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c
index 3d0e8754f..5b0fed928 100644
--- a/libfdisk/src/context.c
+++ b/libfdisk/src/context.c
@@ -343,16 +343,12 @@ int fdisk_enable_bootbits_protection(struct fdisk_context *cxt, int enable)
* @cxt: fdisk context
* @enable: 1 or 0
*
- * The library removes all filesystem/RAID signatures before it writes
- * partition table. The probing area where it looks for filesystem/RAID is from
+ * The library removes all PT/filesystem/RAID signatures before it writes
+ * partition table. The probing area where it looks for signatures is from
* the begin of the disk. The device is wiped by libblkid.
*
* See also fdisk_wipe_partition().
*
- * This is no-op if any collision has not been detected by
- * fdisk_assign_device(). See fdisk_get_collision(). The default is not wipe a
- * device.
- *
* Returns: 0 on success, < 0 on error.
*/
int fdisk_enable_wipe(struct fdisk_context *cxt, int enable)
@@ -360,7 +356,7 @@ int fdisk_enable_wipe(struct fdisk_context *cxt, int enable)
if (!cxt)
return -EINVAL;
- fdisk_set_wipe_area(cxt, 0, cxt->total_sectors * cxt->sector_size, enable);
+ fdisk_set_wipe_area(cxt, 0, cxt->total_sectors, enable);
return 0;
}
@@ -377,7 +373,7 @@ int fdisk_has_wipe(struct fdisk_context *cxt)
if (!cxt)
return 0;
- return fdisk_has_wipe_area(cxt, 0, cxt->total_sectors * cxt->sector_size);
+ return fdisk_has_wipe_area(cxt, 0, cxt->total_sectors);
}