summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2023-03-22 12:50:48 +0100
committerJose M. Guisado <jguisado@soleta.eu>2023-03-22 13:26:43 +0100
commit0352d7733586347f6df5d23ab9bbb54f67e772a0 (patch)
treefeb435b0d0c17ae2f0f295635810df002704c7df
parente4b2964ee0cbacfc12717c06f4bb979ba596493f (diff)
context: wipe new partitions by default
Enable partition wipe to remove any old filesystem/RAID signature when adding a new partition. For example, when adding a new partition in the same start/end where a previous filesystem was created.
-rw-r--r--context.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/context.c b/context.c
index ba63b4a..d0572ec 100644
--- a/context.c
+++ b/context.c
@@ -193,6 +193,11 @@ static PyObject *Context_add_partition(ContextObject *self, PyObject *args, PyOb
PyErr_Format(PyExc_RuntimeError, "Error adding partition to context: %s", strerror(-rc));
return NULL;
}
+ rc = fdisk_wipe_partition(self->cxt, partno, 1);
+ if (rc < 0) {
+ PyErr_Format(PyExc_RuntimeError, "Error setting wipe for new partition: %s", strerror(-rc));
+ return NULL;
+ }
return Py_BuildValue("n", partno);
}