From: Luciano Chavez Date: Fri, 9 Mar 2007 03:07:52 +0000 (-0600) Subject: sfdisk: setting default geometry values X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=653872612c2249dd892f5f2f6cc9b1e3abd24b45;p=util-linux sfdisk: setting default geometry values The cfdisk and fdisk set defaults for heads and sectors in order to handle a situation when the get_geometry() ends up with zeroes for the disk geometry for device-mapper devices. This patch add same functionally to sfdisk. You know that a dmsetup setgeometry of the the dm device can be used to circumvent the issue but users may not immediately realize they need to do that. --- diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index 79e9c20e..baacc077 100644 --- a/fdisk/sfdisk.c +++ b/fdisk/sfdisk.c @@ -469,8 +469,8 @@ get_cylindersize(char *dev, int fd, int silent) { R = get_geometry(dev, fd, silent); - B.heads = (U.heads ? U.heads : R.heads); - B.sectors = (U.sectors ? U.sectors : R.sectors); + B.heads = (U.heads ? U.heads : R.heads ? R.heads : 255); + B.sectors = (U.sectors ? U.sectors : R.sectors ? R.sectors : 63); B.cylinders = (U.cylinders ? U.cylinders : R.cylinders); B.cylindersize = B.heads * B.sectors;