diff options
author | Francesco Cosoleto | 2011-12-15 20:02:45 +0100 |
---|---|---|
committer | Karel Zak | 2011-12-16 14:04:06 +0100 |
commit | b152082db3f516a54ed4855f90aabd361a2e069e (patch) | |
tree | e04958f7374b6a9773bb78a649fea25a9e7e1fc7 /fdisk/fdisk.c | |
parent | fdisk: remove unused guess_device_type() function (diff) | |
download | kernel-qcow2-util-linux-b152082db3f516a54ed4855f90aabd361a2e069e.tar.gz kernel-qcow2-util-linux-b152082db3f516a54ed4855f90aabd361a2e069e.tar.xz kernel-qcow2-util-linux-b152082db3f516a54ed4855f90aabd361a2e069e.zip |
fdisk: don't use get_existing_partition() if disk label isn't dos
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Diffstat (limited to 'fdisk/fdisk.c')
-rw-r--r-- | fdisk/fdisk.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 8f5869dcf..53eed250a 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -1472,11 +1472,16 @@ get_partition(int warn, int max) { return get_partition_dflt(warn, max, 0); } +/* User partition selection unless one partition only is available */ + static int get_existing_partition(int warn, int max) { int pno = -1; int i; + if (disklabel != DOS_LABEL) + goto not_implemented; + for (i = 0; i < max; i++) { struct pte *pe = &ptes[i]; struct partition *p = pe->part_table; @@ -1495,7 +1500,8 @@ get_existing_partition(int warn, int max) { printf(_("No partition is defined yet!\n")); return -1; - not_unique: +not_implemented: +not_unique: return get_partition(warn, max); } @@ -1650,14 +1656,7 @@ change_sysid(void) { int i, sys, origsys; struct partition *p; - /* If sgi_label then don't use get_existing_partition, - let the user select a partition, since get_existing_partition() - only works for Linux like partition tables. */ - if (disklabel != SGI_LABEL) { - i = get_existing_partition(0, partitions); - } else { - i = get_partition(0, partitions); - } + i = get_existing_partition(0, partitions); if (i == -1) return; @@ -2922,15 +2921,7 @@ static void command_prompt(void) unknown_command(c); break; case 'd': - /* If sgi_label then don't use get_existing_partition, - let the user select a partition, since - get_existing_partition() only works for Linux-like - partition tables */ - if (disklabel != SGI_LABEL) { - j = get_existing_partition(1, partitions); - } else { - j = get_partition(1, partitions); - } + j = get_existing_partition(1, partitions); if (j >= 0) delete_partition(j); break; |