cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
531551
From 44baaedaffee029dca76796b933412d97a19dff6 Mon Sep 17 00:00:00 2001
531551
From: Karel Zak <kzak@redhat.com>
531551
Date: Mon, 9 Sep 2013 10:57:50 +0200
531551
Subject: [PATCH] libfdisk: fix SIGFPE
531551
531551
 #0 recount_geometry at libfdisk/src/alignment.c:143
531551
 #1 fdisk_discover_geometry at libfdisk/src/alignment.c:205
531551
 #2 fdisk_context_assign_device at libfdisk/src/context.c:173
531551
 #3 print_partition_table_from_option at fdisks/fdisk.c:924
531551
531551
References: https://bugzilla.redhat.com/show_bug.cgi?id=1005566
531551
Signed-off-by: Karel Zak <kzak@redhat.com>
531551
---
531551
 libfdisk/src/alignment.c | 9 +++++----
531551
 1 file changed, 5 insertions(+), 4 deletions(-)
531551
531551
diff --git a/libfdisk/src/alignment.c b/libfdisk/src/alignment.c
531551
index ac44e73..4d4ab48 100644
531551
--- a/libfdisk/src/alignment.c
531551
+++ b/libfdisk/src/alignment.c
531551
@@ -193,11 +193,12 @@ int fdisk_discover_geometry(struct fdisk_context *cxt)
531551
 
531551
 	/* what the kernel/bios thinks the geometry is */
531551
 	blkdev_get_geometry(cxt->dev_fd, &h, &s);
531551
-	if (!h && !s) {
531551
-		/* unable to discover geometry, use default values */
531551
-		s = 63;
531551
+
531551
+	/* defaults */
531551
+	if (!h)
531551
 		h = 255;
531551
-	}
531551
+	if (!s)
531551
+		s = 63;
531551
 
531551
 	/* obtained heads and sectors */
531551
 	cxt->geom.heads = h;
531551
-- 
531551
1.8.1.4
531551