parted/0107-parted-Remove-PED_ASSERT-from-ped_partition_set_name.patch
Brian C. Lane 21f562c24e - Add missing patches from Wang Dong
- fix crash due to improper partition number (dongdwdw)
- fix wrong error label jump in mkpart (dongdwdw)
- clean the disk information when commands fail (dongdwdw)
- Remove PED_ASSERT from ped_partition_set_name (bcl)
- Added support for Windows recovery partition (Hans-Joachim.Baader)
2019-01-31 11:35:57 -08:00

33 lines
1.1 KiB
Diff

From 0601c8ea6de92017ee8c6293db102029e309b166 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 31 Jan 2019 08:59:55 -0800
Subject: [PATCH] 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.
---
parted/parted.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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))
--
2.20.1