Subject: Patch for fix where parted crashes when exiting

From: Felipe Magno de Almeida <[email-masked]>
Date: Tue, 10 Jun 2025 09:12:49 -0300

-- 
--
Felipe Magno de Almeida
Owner @ Expertise Solutions
www: https://expertise.dev
phone: +55 48 9 9681.0157
LinkedIn: in/felipealmeida
From fb3400faa72ae58de3c7e4068704fa5be7128097 Mon Sep 17 00:00:00 2001
From: Felipe Magno de Almeida <[email-masked]>
Date: Thu, 27 Mar 2025 23:19:25 -0300
Subject: [PATCH] Fix initialization of atr_c_locale inside PED_ASSERT

PED_ASSERT is disabled when used --disable-debug, which causes the
expression to not be executed and atr_c_locale never being assigned
and a crash on ped_disk_atari_done when exiting the application.
---
 libparted/labels/atari.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libparted/labels/atari.c b/libparted/labels/atari.c
index 8ab3720..e450cd0 100644
--- a/libparted/labels/atari.c
+++ b/libparted/labels/atari.c
@@ -1962,7 +1962,8 @@ ped_disk_atari_init ()
 	PED_ASSERT (sizeof (AtariRawPartition) == 12);
 	PED_ASSERT (sizeof (AtariRawTable) == 512);
 	/* GNU Libc doesn't support NULL instead of the locale name */
-	PED_ASSERT ((atr_c_locale = newlocale(LC_ALL_MASK, "C", NULL)) != NULL);
+        atr_c_locale = newlocale(LC_ALL_MASK, "C", NULL);
+	PED_ASSERT (atr_c_locale != NULL);
 
 	ped_disk_type_register (&atari_disk_type);
 }
-- 
2.49.0