From cdcecf63b65e606adf2d692c6f71ca247237361e Mon Sep 17 00:00:00 2001 From: Karel Zak 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 Signed-off-by: Karel Zak --- fdisk/fdisk.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 9c587df6..a0e67c9f 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -1193,7 +1193,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 @@ -1206,7 +1207,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 */ -- 2.39.5