summaryrefslogtreecommitdiffstats
path: root/libfdisk/src
diff options
context:
space:
mode:
Diffstat (limited to 'libfdisk/src')
-rw-r--r--libfdisk/src/Makemodule.am4
-rw-r--r--libfdisk/src/ask.c4
-rw-r--r--libfdisk/src/bsd.c4
-rw-r--r--libfdisk/src/context.c2
-rw-r--r--libfdisk/src/dos.c18
-rw-r--r--libfdisk/src/fdiskP.h2
-rw-r--r--libfdisk/src/gpt.c27
-rw-r--r--libfdisk/src/item.c6
-rw-r--r--libfdisk/src/libfdisk.h.in3
-rw-r--r--libfdisk/src/libfdisk.sym4
-rw-r--r--libfdisk/src/partition.c52
-rw-r--r--libfdisk/src/parttype.c13
-rw-r--r--libfdisk/src/script.c32
-rw-r--r--libfdisk/src/sgi.c13
-rw-r--r--libfdisk/src/sun.c6
-rw-r--r--libfdisk/src/utils.c10
-rw-r--r--libfdisk/src/version.c4
-rw-r--r--libfdisk/src/wipe.c14
18 files changed, 164 insertions, 54 deletions
diff --git a/libfdisk/src/Makemodule.am b/libfdisk/src/Makemodule.am
index 9bd64c1..073d571 100644
--- a/libfdisk/src/Makemodule.am
+++ b/libfdisk/src/Makemodule.am
@@ -67,7 +67,7 @@ check_PROGRAMS += \
test_fdisk_version \
test_fdisk_item
-libfdisk_tests_cflags = -DTEST_PROGRAM $(libfdisk_la_CFLAGS) $(NO_UNUSED_WARN_CFLAGS)
+libfdisk_tests_cflags = -DTEST_PROGRAM $(libfdisk_la_CFLAGS)
libfdisk_tests_ldflags = libuuid.la -static
libfdisk_tests_ldadd = libfdisk.la $(LDADD)
@@ -102,7 +102,7 @@ check_PROGRAMS += test_fdisk_script_fuzz
nodist_EXTRA_test_fdisk_script_fuzz_SOURCES = dummy.cxx
test_fdisk_script_fuzz_SOURCES = libfdisk/src/script.c
-test_fdisk_script_fuzz_CFLAGS = -DFUZZ_TARGET $(libfdisk_la_CFLAGS) $(NO_UNUSED_WARN_CFLAGS)
+test_fdisk_script_fuzz_CFLAGS = -DFUZZ_TARGET $(libfdisk_la_CFLAGS)
test_fdisk_script_fuzz_LDFLAGS = $(libfdisk_tests_ldflags) -lpthread
test_fdisk_script_fuzz_LDADD = $(libfdisk_tests_ldadd) $(LIB_FUZZING_ENGINE)
endif
diff --git a/libfdisk/src/ask.c b/libfdisk/src/ask.c
index 274f6ba..299f65b 100644
--- a/libfdisk/src/ask.c
+++ b/libfdisk/src/ask.c
@@ -1035,7 +1035,9 @@ int fdisk_info_new_partition(
}
#ifdef TEST_PROGRAM
-static int test_ranges(struct fdisk_test *ts, int argc, char *argv[])
+static int test_ranges(struct fdisk_test *ts __attribute__((unused)),
+ int argc __attribute__((unused)),
+ char *argv[] __attribute__((unused)))
{
/* 1 - 3, 6, 8, 9, 11 13 */
size_t nums[] = { 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1 };
diff --git a/libfdisk/src/bsd.c b/libfdisk/src/bsd.c
index 313ae5a..cb45e3f 100644
--- a/libfdisk/src/bsd.c
+++ b/libfdisk/src/bsd.c
@@ -30,7 +30,7 @@
*
*/
-static const char *bsd_dktypenames[] = {
+static const char * const bsd_dktypenames[] = {
"unknown",
"SMD",
"MSCP",
@@ -46,7 +46,7 @@ static const char *bsd_dktypenames[] = {
};
#define BSD_DKMAXTYPES (ARRAY_SIZE(bsd_dktypenames) - 1)
-static struct fdisk_parttype bsd_fstypes[] = {
+static const struct fdisk_parttype bsd_fstypes[] = {
{BSD_FS_UNUSED, "unused"},
{BSD_FS_SWAP, "swap"},
{BSD_FS_V6, "Version 6"},
diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c
index 0d22124..463a60f 100644
--- a/libfdisk/src/context.c
+++ b/libfdisk/src/context.c
@@ -773,7 +773,7 @@ int fdisk_deassign_device(struct fdisk_context *cxt, int nosync)
cxt->dev_path);
return -errno;
}
- if (!nosync) {
+ if (S_ISBLK(cxt->dev_st.st_mode) && !nosync) {
fdisk_info(cxt, _("Syncing disks."));
sync();
}
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index 7970ae1..ecf0b36 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -67,7 +67,7 @@ struct fdisk_dos_label {
/*
* Partition types
*/
-static struct fdisk_parttype dos_parttypes[] = {
+static const struct fdisk_parttype dos_parttypes[] = {
#include "pt-mbr-partnames.h"
};
@@ -792,7 +792,7 @@ static void get_partition_table_geometry(struct fdisk_context *cxt,
unsigned char *bufp = cxt->firstsector;
struct { unsigned int c, h, o, v; } t[8];
unsigned int n1, n2, n3, n4, n5, n6;
- struct dos_partition *p;
+ const struct dos_partition *p;
unsigned int c, h, s, l;
unsigned int hh, ss;
unsigned int sects;
@@ -1727,14 +1727,22 @@ static int dos_verify_disklabel(struct fdisk_context *cxt)
{
size_t i, j;
fdisk_sector_t total = 1, n_sectors = cxt->total_sectors;
- fdisk_sector_t first[cxt->label->nparts_max],
- last[cxt->label->nparts_max];
+ fdisk_sector_t *first, *last;
struct dos_partition *p;
struct fdisk_dos_label *l = self_label(cxt);
int nerrors = 0;
assert(fdisk_is_label(cxt, DOS));
+ first = calloc(cxt->label->nparts_max, sizeof(*first));
+ last = calloc(cxt->label->nparts_max, sizeof(*first));
+
+ if (!first || !last) {
+ free(first);
+ free(last);
+ return -ENOMEM;
+ }
+
fill_bounds(cxt, first, last);
for (i = 0; i < cxt->label->nparts_max; i++) {
struct pte *pe = self_pte(cxt, i);
@@ -1818,6 +1826,8 @@ static int dos_verify_disklabel(struct fdisk_context *cxt)
P_("%d error detected.", "%d errors detected.", nerrors),
nerrors);
+ free(first);
+ free(last);
return nerrors;
}
diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h
index 7c0830e..49e057f 100644
--- a/libfdisk/src/fdiskP.h
+++ b/libfdisk/src/fdiskP.h
@@ -286,7 +286,7 @@ enum {
struct fdisk_label {
const char *name; /* label name */
enum fdisk_labeltype id; /* FDISK_DISKLABEL_* */
- struct fdisk_parttype *parttypes; /* supported partitions types */
+ const struct fdisk_parttype *parttypes; /* supported partitions types */
size_t nparttypes; /* number of items in parttypes[] */
const struct fdisk_shortcut *parttype_cuts; /* partition type shortcuts */
diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c
index c3c0347..1c19d86 100644
--- a/libfdisk/src/gpt.c
+++ b/libfdisk/src/gpt.c
@@ -152,19 +152,20 @@ struct gpt_legacy_mbr {
.name = (_n), \
}
-static struct fdisk_parttype gpt_parttypes[] =
+static const struct fdisk_parttype gpt_parttypes[] =
{
#include "pt-gpt-partnames.h"
};
static const struct fdisk_shortcut gpt_parttype_cuts[] =
{
- { .shortcut = "L", .alias = "linux", .data = "0FC63DAF-8483-4772-8E79-3D69D8477DE4" }, /* Linux */
- { .shortcut = "S", .alias = "swap", .data = "0657FD6D-A4AB-43C4-84E5-0933C84B4F4F" }, /* Swap */
- { .shortcut = "H", .alias = "home", .data = "933AC7E1-2EB4-4F13-B844-0E14E2AEF915" }, /* Home */
- { .shortcut = "U", .alias = "uefi", .data = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" }, /* UEFI system */
- { .shortcut = "R", .alias = "raid", .data = "A19D880F-05FC-4D3B-A006-743F0F84911E" }, /* Linux RAID */
- { .shortcut = "V", .alias = "lvm", .data = "E6D6D379-F507-44C2-A23C-238F2A3DF928" } /* LVM */
+ { .shortcut = "L", .alias = "linux", .data = "0FC63DAF-8483-4772-8E79-3D69D8477DE4" }, /* Linux */
+ { .shortcut = "S", .alias = "swap", .data = "0657FD6D-A4AB-43C4-84E5-0933C84B4F4F" }, /* Swap */
+ { .shortcut = "H", .alias = "home", .data = "933AC7E1-2EB4-4F13-B844-0E14E2AEF915" }, /* Home */
+ { .shortcut = "U", .alias = "uefi", .data = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" }, /* UEFI system */
+ { .shortcut = "R", .alias = "raid", .data = "A19D880F-05FC-4D3B-A006-743F0F84911E" }, /* Linux RAID */
+ { .shortcut = "V", .alias = "lvm", .data = "E6D6D379-F507-44C2-A23C-238F2A3DF928" }, /* LVM */
+ { .shortcut = "X", .alias = "xbootldr", .data = "BC13C2FF-59E6-4262-A352-B275FD6F7172" }, /* Linux extended boot */
};
#define alignment_required(_x) ((_x)->grain != (_x)->sector_size)
@@ -3322,8 +3323,12 @@ void fdisk_gpt_enable_minimize(struct fdisk_label *lb, int enable)
}
#ifdef TEST_PROGRAM
-static int test_getattr(struct fdisk_test *ts, int argc, char *argv[])
+static int test_getattr(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 3)
+ return -1;
+
const char *disk = argv[1];
size_t part = strtoul(argv[2], NULL, 0) - 1;
struct fdisk_context *cxt;
@@ -3344,8 +3349,12 @@ static int test_getattr(struct fdisk_test *ts, int argc, char *argv[])
return 0;
}
-static int test_setattr(struct fdisk_test *ts, int argc, char *argv[])
+static int test_setattr(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 4)
+ return -1;
+
const char *disk = argv[1];
size_t part = strtoul(argv[2], NULL, 0) - 1;
uint64_t atters = strtoull(argv[3], NULL, 0);
diff --git a/libfdisk/src/item.c b/libfdisk/src/item.c
index 671f9ad..f46e646 100644
--- a/libfdisk/src/item.c
+++ b/libfdisk/src/item.c
@@ -199,8 +199,12 @@ int fdisk_labelitem_is_number(struct fdisk_labelitem *li)
}
#ifdef TEST_PROGRAM
-static int test_listitems(struct fdisk_test *ts, int argc, char *argv[])
+static int test_listitems(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 2)
+ return -1;
+
const char *disk = argv[1];
struct fdisk_context *cxt;
struct fdisk_labelitem *item;
diff --git a/libfdisk/src/libfdisk.h.in b/libfdisk/src/libfdisk.h.in
index 1c97149..9c20f44 100644
--- a/libfdisk/src/libfdisk.h.in
+++ b/libfdisk/src/libfdisk.h.in
@@ -540,6 +540,9 @@ extern int fdisk_reorder_partitions(struct fdisk_context *cxt);
extern int fdisk_partition_has_wipe(struct fdisk_context *cxt, struct fdisk_partition *pa);
+extern int fdisk_partition_get_max_size(struct fdisk_context *cxt, size_t n,
+ fdisk_sector_t *maxsz);
+
/* table.c */
extern struct fdisk_table *fdisk_new_table(void);
diff --git a/libfdisk/src/libfdisk.sym b/libfdisk/src/libfdisk.sym
index 71de805..bb69e93 100644
--- a/libfdisk/src/libfdisk.sym
+++ b/libfdisk/src/libfdisk.sym
@@ -320,3 +320,7 @@ FDISK_2.36 {
FDISK_2.38 {
fdisk_dos_fix_chs;
} FDISK_2.36;
+
+FDISK_2.40 {
+ fdisk_partition_get_max_size;
+} FDISK_2.38;
diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c
index bf3afad..1fd3176 100644
--- a/libfdisk/src/partition.c
+++ b/libfdisk/src/partition.c
@@ -1625,3 +1625,55 @@ int fdisk_is_partition_used(struct fdisk_context *cxt, size_t n)
return cxt->label->op->part_is_used(cxt, n);
}
+
+/**
+ * fdisk_partition_max_size:
+ * @cxt: context
+ * @n: partition number (0 is the first partition)
+ * @maxsz: returns maximum size of partition
+ *
+ * Find maximum size the partition can be resized to.
+ * Takes into account free space between this partition and the next one.
+ *
+ * Returns: 0 on success, <0 on error.
+ */
+int fdisk_partition_get_max_size(struct fdisk_context *cxt, size_t n,
+ fdisk_sector_t *maxsz)
+{
+ struct fdisk_partition *cur = NULL;
+ struct fdisk_table *tb = NULL;
+ int rc;
+
+ rc = fdisk_get_partitions(cxt, &tb);
+ if (rc)
+ goto out;
+
+ rc = fdisk_get_freespaces(cxt, &tb);
+ if (rc)
+ goto out;
+
+ rc = fdisk_table_sort_partitions(tb, fdisk_partition_cmp_start);
+ if (rc)
+ goto out;
+
+ cur = fdisk_table_get_partition_by_partno(tb, n);
+ if (!cur)
+ goto einval;
+
+ if (!fdisk_partition_has_start(cur))
+ goto einval;
+
+ if (resize_get_last_possible(tb, cur,
+ fdisk_partition_get_start(cur), maxsz))
+ goto einval;
+
+out:
+ fdisk_unref_partition(cur);
+ fdisk_unref_table(tb);
+
+ return rc;
+
+einval:
+ rc = -EINVAL;
+ goto out;
+}
diff --git a/libfdisk/src/parttype.c b/libfdisk/src/parttype.c
index 271b671..8566932 100644
--- a/libfdisk/src/parttype.c
+++ b/libfdisk/src/parttype.c
@@ -145,7 +145,7 @@ struct fdisk_parttype *fdisk_label_get_parttype(const struct fdisk_label *lb, si
{
if (!lb || n >= lb->nparttypes)
return NULL;
- return &lb->parttypes[n];
+ return (struct fdisk_parttype *)&lb->parttypes[n];
}
/**
@@ -237,7 +237,7 @@ struct fdisk_parttype *fdisk_label_get_parttype_from_code(
for (i = 0; i < lb->nparttypes; i++)
if (lb->parttypes[i].code == code)
- return &lb->parttypes[i];
+ return (struct fdisk_parttype *)&lb->parttypes[i];
return NULL;
}
@@ -265,7 +265,7 @@ struct fdisk_parttype *fdisk_label_get_parttype_from_string(
for (i = 0; i < lb->nparttypes; i++)
if (lb->parttypes[i].typestr
&& strcasecmp(lb->parttypes[i].typestr, str) == 0)
- return &lb->parttypes[i];
+ return (struct fdisk_parttype *)&lb->parttypes[i];
return NULL;
}
@@ -324,7 +324,8 @@ static struct fdisk_parttype *parttype_from_data(
unsigned int *xcode,
int use_seqnum)
{
- struct fdisk_parttype *types, *ret = NULL;
+ const struct fdisk_parttype *types;
+ struct fdisk_parttype *ret = NULL;
char *end = NULL;
assert(lb);
@@ -369,7 +370,7 @@ static struct fdisk_parttype *parttype_from_data(
if (use_seqnum && errno == 0
&& *end == '\0' && i > 0
&& i - 1 < (int) lb->nparttypes)
- ret = &types[i - 1];
+ ret = (struct fdisk_parttype *)&types[i - 1];
}
}
@@ -428,7 +429,7 @@ static struct fdisk_parttype *parttype_from_name(
const char *name = lb->parttypes[i].name;
if (name && *name && ul_stralnumcmp(name, str) == 0)
- return &lb->parttypes[i];
+ return (struct fdisk_parttype *)&lb->parttypes[i];
}
return NULL;
diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c
index f537a7d..e357fad 100644
--- a/libfdisk/src/script.c
+++ b/libfdisk/src/script.c
@@ -1108,7 +1108,7 @@ static int parse_size_value(struct fdisk_script *dp, struct fdisk_partition *pa,
done:
DBG(SCRIPT, ul_debugobj(dp, " size parse result: rc=%d, move=%s, size=%ju, default=%s",
rc, pa->resize == FDISK_RESIZE_REDUCE ? "reduce" :
- pa->resize == FDISK_RESIZE_ENLARGE ? "enlage" : "none",
+ pa->resize == FDISK_RESIZE_ENLARGE ? "enlarge" : "none",
pa->size,
pa->end_follow_default ? "on" : "off"));
return rc;
@@ -1669,8 +1669,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
#endif
#ifdef TEST_PROGRAM
-static int test_dump(struct fdisk_test *ts, int argc, char *argv[])
+static int test_dump(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 2)
+ return -1;
+
char *devname = argv[1];
struct fdisk_context *cxt;
struct fdisk_script *dp;
@@ -1688,8 +1692,12 @@ static int test_dump(struct fdisk_test *ts, int argc, char *argv[])
return 0;
}
-static int test_read(struct fdisk_test *ts, int argc, char *argv[])
+static int test_read(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 2)
+ return -1;
+
char *filename = argv[1];
struct fdisk_script *dp;
struct fdisk_context *cxt;
@@ -1711,8 +1719,12 @@ static int test_read(struct fdisk_test *ts, int argc, char *argv[])
return 0;
}
-static int test_stdin(struct fdisk_test *ts, int argc, char *argv[])
+static int test_stdin(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[] __attribute__((unused)))
{
+ if (argc != 1)
+ return -1;
+
char buf[BUFSIZ] = { '\0' };
struct fdisk_script *dp;
struct fdisk_context *cxt;
@@ -1746,8 +1758,12 @@ static int test_stdin(struct fdisk_test *ts, int argc, char *argv[])
return rc;
}
-static int test_apply(struct fdisk_test *ts, int argc, char *argv[])
+static int test_apply(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 3)
+ return -1;
+
char *devname = argv[1], *scriptname = argv[2];
struct fdisk_context *cxt;
struct fdisk_script *dp;
@@ -1788,8 +1804,12 @@ done:
return 0;
}
-static int test_tokens(struct fdisk_test *ts, int argc, char *argv[])
+static int test_tokens(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 2)
+ return -1;
+
char *p, *str = argc == 2 ? strdup(argv[1]) : NULL;
int i;
diff --git a/libfdisk/src/sgi.c b/libfdisk/src/sgi.c
index 6740535..23aafd9 100644
--- a/libfdisk/src/sgi.c
+++ b/libfdisk/src/sgi.c
@@ -41,7 +41,7 @@ struct fdisk_sgi_label {
} freelist[SGI_MAXPARTITIONS + 1];
};
-static struct fdisk_parttype sgi_parttypes[] =
+static const struct fdisk_parttype sgi_parttypes[] =
{
{SGI_TYPE_VOLHDR, N_("SGI volhdr")},
{SGI_TYPE_TRKREPL, N_("SGI trkrepl")},
@@ -123,10 +123,12 @@ static struct sgi_info *sgi_new_info(void)
info->b3 = cpu_to_be16(1);
/* You may want to replace this string !!!!!!! */
- strcpy((char *) info->scsi_string, "IBM OEM 0662S12 3 30");
- strcpy((char *) info->serial, "0000");
+ strncpy((char *) info->scsi_string, "IBM OEM 0662S12 3 30",
+ sizeof(info->scsi_string));
+ strncpy((char *) info->serial, "0000", sizeof(info->serial));
info->check1816 = cpu_to_be16(18 * 256 + 16);
- strcpy((char *) info->installer, "Sfx version 5.3, Oct 18, 1994");
+ strncpy((char *) info->installer, "Sfx version 5.3, Oct 18, 1994",
+ sizeof(info->installer));
return info;
}
@@ -1009,7 +1011,8 @@ static int sgi_create_disklabel(struct fdisk_context *cxt)
/* sizeof(sgilabel->boot_file) = 16 > 6 */
memset(sgilabel->boot_file, 0, 16);
- strcpy((char *) sgilabel->boot_file, "/unix");
+ strncpy((char *) sgilabel->boot_file, "/unix",
+ sizeof(sgilabel->boot_file));
sgilabel->devparam.skew = (0);
sgilabel->devparam.gap1 = (0);
diff --git a/libfdisk/src/sun.c b/libfdisk/src/sun.c
index dde9750..cd965ab 100644
--- a/libfdisk/src/sun.c
+++ b/libfdisk/src/sun.c
@@ -35,7 +35,7 @@ struct fdisk_sun_label {
struct sun_disklabel *header; /* on-disk data (pointer to cxt->firstsector) */
};
-static struct fdisk_parttype sun_parttypes[] = {
+static const struct fdisk_parttype sun_parttypes[] = {
{SUN_TAG_UNASSIGNED, N_("Unassigned")},
{SUN_TAG_BOOT, N_("Boot")},
{SUN_TAG_ROOT, N_("SunOS root")},
@@ -383,6 +383,10 @@ static void fetch_sun(struct fdisk_context *cxt,
lens[i] = 0;
}
}
+ for (i = cxt->label->nparts_max; i < SUN_MAXPARTITIONS; i++) {
+ starts[i] = 0;
+ lens[i] = 0;
+ }
}
/* non-Linux qsort_r(3) has usually differently ordered arguments */
diff --git a/libfdisk/src/utils.c b/libfdisk/src/utils.c
index 6b6167d..a7c8bfa 100644
--- a/libfdisk/src/utils.c
+++ b/libfdisk/src/utils.c
@@ -183,11 +183,15 @@ done:
}
#ifdef TEST_PROGRAM
-struct fdisk_label *fdisk_new_dos_label(struct fdisk_context *cxt) { return NULL; }
-struct fdisk_label *fdisk_new_bsd_label(struct fdisk_context *cxt) { return NULL; }
+struct fdisk_label *fdisk_new_dos_label(struct fdisk_context *cxt __attribute__((unused))) { return NULL; }
+struct fdisk_label *fdisk_new_bsd_label(struct fdisk_context *cxt __attribute__((unused))) { return NULL; }
-static int test_partnames(struct fdisk_test *ts, int argc, char *argv[])
+static int test_partnames(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 2)
+ return -1;
+
size_t i;
const char *disk = argv[1];
diff --git a/libfdisk/src/version.c b/libfdisk/src/version.c
index 9d84b4c..b0661e2 100644
--- a/libfdisk/src/version.c
+++ b/libfdisk/src/version.c
@@ -91,7 +91,9 @@ int fdisk_get_library_features(const char ***features)
}
#ifdef TEST_PROGRAM
-static int test_version(struct fdisk_test *ts, int argc, char *argv[])
+static int test_version(struct fdisk_test *ts __attribute__((unused)),
+ int argc __attribute__((unused)),
+ char *argv[] __attribute__((unused)))
{
const char *ver;
const char **features;
diff --git a/libfdisk/src/wipe.c b/libfdisk/src/wipe.c
index 54f4213..bb5f1bb 100644
--- a/libfdisk/src/wipe.c
+++ b/libfdisk/src/wipe.c
@@ -75,6 +75,7 @@ int fdisk_set_wipe_area(struct fdisk_context *cxt,
free(wp);
return 1;
}
+ DBG(WIPE, ul_debug("not requested"));
return 0;
}
@@ -133,17 +134,8 @@ int fdisk_do_wipe(struct fdisk_context *cxt)
return rc;
}
- blkid_probe_enable_superblocks(pr, 1);
- blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_MAGIC |
- BLKID_SUBLKS_BADCSUM);
- blkid_probe_enable_partitions(pr, 1);
- blkid_probe_set_partitions_flags(pr, BLKID_PARTS_MAGIC |
- BLKID_PARTS_FORCE_GPT);
-
- while (blkid_do_probe(pr) == 0) {
- DBG(WIPE, ul_debugobj(wp, " wiping..."));
- blkid_do_wipe(pr, FALSE);
- }
+ DBG(WIPE, ul_debugobj(wp, " wiping..."));
+ blkid_wipe_all(pr);
}
blkid_free_probe(pr);