[parted-devel] [PATCH 1/4] libparted: Fix sun disklabel unhandled exception

Brian C. Lane bcl at redhat.com
Thu Jan 9 01:01:46 GMT 2025


The CHS warning should only continue if ignored, not if unhandled.

Script mode, or exception handlers can return PED_EXCEPTION_UNHANDLED
which should act the same as a cancel. Previously it would only exit if
cancel was selected, allowing it to continue to use the bad CHS and
crash later.
---
 libparted/labels/sun.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libparted/labels/sun.c b/libparted/labels/sun.c
index 5ed2886..853576b 100644
--- a/libparted/labels/sun.c
+++ b/libparted/labels/sun.c
@@ -284,7 +284,7 @@ _check_geometry_sanity (PedDisk* disk, SunRawLabel* label)
 				PED_BE16_TO_CPU(label->pcylcount),
 				PED_BE16_TO_CPU(label->ntrks),
 				PED_BE16_TO_CPU(label->nsect))
-			== PED_EXCEPTION_CANCEL)
+			!= PED_EXCEPTION_IGNORE)
 			return 0;
 #endif
 		dev->bios_geom.sectors = PED_BE16_TO_CPU(label->nsect);
-- 
2.47.1




More information about the parted-devel mailing list