]> err.no Git - util-linux/commitdiff
fdisk: support +cylinder notation
authorKarel Zak <kzak@redhat.com>
Thu, 13 Nov 2008 22:08:34 +0000 (23:08 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 12 Dec 2008 11:36:03 +0000 (12:36 +0100)
Currently fdisk does not support +cylinder notation and reports
"Unsupported suffix: ''".

Reported-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisk/fdisk.c

index 9c587df6e51533051b1e81ce9d58e9a4d918f4bf..a0e67c9fc0daf69a35fb7573159f04c78044b22c 100644 (file)
@@ -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
                                 */