On Wed, Nov 05, 2008 at 06:36:38PM +0100, Matthias Koenig wrote: > Currently fdisk does not support +cylinder notation and reports > Unsupported suffix: ''. Uf.. stupid bug. Sorry. > diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c > index a8dfe5d..16222f9 100644 > --- a/fdisk/fdisk.c > +++ b/fdisk/fdisk.c > @@ -1200,8 +1200,9 @@ read_int(unsigned int low, unsigned int dflt, unsigned int high, > while(isspace(*(line_ptr + suflen))) > *(line_ptr + suflen--) = '\0'; > > - if ((*line_ptr == 'C' || *line_ptr == 'c') && > - *(line_ptr + 1) == '\0') { > + if (((*line_ptr == 'C' || *line_ptr == 'c') && > + *(line_ptr + 1) == '\0') || > + *line_ptr == '\0') { I think this is not a correct bug fix. The problem is that the read_int() is a generic function and we shouldn't use "cylinders" as a default. The default behavior is to return the number without any conversion. We need to more pedantically check suffixes for N^2 notation. Thanks! Karel >From 5ea8931c95b2e0b1663f28591d2c721f07a88181 Mon Sep 17 00:00:00 2001 From: Karel Zak <kzak@xxxxxxxxxx> Date: Thu, 13 Nov 2008 23:08:34 +0100 Subject: [PATCH] fdisk: support +cylinder notation Currently fdisk does not support +cylinder notation and reports "Unsupported suffix: ''". Reported-by: Matthias Koenig <mkoenig@xxxxxxx> Signed-off-by: Karel Zak <kzak@xxxxxxxxxx> --- fdisk/fdisk.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 84e1860..9504e7a 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -1207,7 +1207,8 @@ read_int(unsigned int low, unsigned int dflt, unsigned int high, */ if (!display_in_cyl_units) i *= heads * sectors; - } else if (*(line_ptr + 1) == 'B' && + } else if (*line_ptr && + *(line_ptr + 1) == 'B' && *(line_ptr + 2) == '\0') { /* * 10^N @@ -1220,7 +1221,8 @@ read_int(unsigned int low, unsigned int dflt, unsigned int high, absolute = 1000000000; else absolute = -1; - } else if (*(line_ptr + 1) == '\0') { + } else if (*line_ptr && + *(line_ptr + 1) == '\0') { /* * 2^N */ -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html