summaryrefslogtreecommitdiffstats
path: root/fdisk/fdisk.c
diff options
context:
space:
mode:
authorKarel Zak2008-11-13 23:08:34 +0100
committerKarel Zak2008-11-13 23:08:34 +0100
commit5ea8931c95b2e0b1663f28591d2c721f07a88181 (patch)
tree66b21806d5bc5528eea410b8216c5d14849648ab /fdisk/fdisk.c
parentfdisk: read /proc/partitions in more robust way (diff)
downloadkernel-qcow2-util-linux-5ea8931c95b2e0b1663f28591d2c721f07a88181.tar.gz
kernel-qcow2-util-linux-5ea8931c95b2e0b1663f28591d2c721f07a88181.tar.xz
kernel-qcow2-util-linux-5ea8931c95b2e0b1663f28591d2c721f07a88181.zip
fdisk: support +cylinder notation
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>
Diffstat (limited to 'fdisk/fdisk.c')
-rw-r--r--fdisk/fdisk.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 84e1860f2..9504e7ae6 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
*/