summaryrefslogtreecommitdiff
path: root/parted
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2019-01-31 08:59:55 -0800
committerBrian C. Lane <bcl@redhat.com>2019-01-31 10:15:13 -0800
commit0601c8ea6de92017ee8c6293db102029e309b166 (patch)
tree9e191bc6420b6add61b05b7d7c90b92b78ec8611 /parted
parent9fe7e4a1f676331fafdf4e15c2b02c0ded3df694 (diff)
downloadparted-0601c8ea6de92017ee8c6293db102029e309b166.tar.gz
parted: Remove PED_ASSERT from ped_partition_set_name
Asserts should only check logic, not wrap functions with side-effects. When compiled with --disable-debug this causes the name field of mkpart to be ignored.
Diffstat (limited to 'parted')
-rw-r--r--parted/parted.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/parted/parted.c b/parted/parted.c
index 35432c6..c0600ea 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -814,9 +814,11 @@ do_mkpart (PedDevice** dev, PedDisk** diskp)
/* set minor attributes */
if (part_name)
- PED_ASSERT (ped_partition_set_name (part, part_name));
+ if (!ped_partition_set_name (part, part_name))
+ goto error_remove_part;
free (part_name); /* avoid double-free upon failure */
part_name = NULL;
+
if (!ped_partition_set_system (part, fs_type))
goto error_remove_part;
if (ped_partition_is_flag_available (part, PED_PARTITION_LBA))