diff options
author | Francesco Cosoleto | 2011-12-15 20:02:46 +0100 |
---|---|---|
committer | Karel Zak | 2011-12-16 14:04:07 +0100 |
commit | 4a96a62a093b1f07164334a5523e5942077a87e7 (patch) | |
tree | f55e95d7ee061ab830a77db4ac2391a01eb9f5c4 /fdisk/fdisk.c | |
parent | fdisk: don't use get_existing_partition() if disk label isn't dos (diff) | |
download | kernel-qcow2-util-linux-4a96a62a093b1f07164334a5523e5942077a87e7.tar.gz kernel-qcow2-util-linux-4a96a62a093b1f07164334a5523e5942077a87e7.tar.xz kernel-qcow2-util-linux-4a96a62a093b1f07164334a5523e5942077a87e7.zip |
fdisk: avoid an intermediate variable in command_prompt()
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Diffstat (limited to 'fdisk/fdisk.c')
-rw-r--r-- | fdisk/fdisk.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 53eed250a..acf0e673d 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -1635,6 +1635,9 @@ static void dos_delete_partition(int i) static void delete_partition(int i) { + if (i < 0) + return; + if (warn_geometry()) return; /* C/H/S not set */ @@ -2869,7 +2872,7 @@ unknown_command(int c) { static void command_prompt(void) { - int c, j; + int c; if (disklabel == OSF_LABEL) { putchar('\n'); @@ -2921,9 +2924,7 @@ static void command_prompt(void) unknown_command(c); break; case 'd': - j = get_existing_partition(1, partitions); - if (j >= 0) - delete_partition(j); + delete_partition(get_existing_partition(1, partitions)); break; case 'i': if (disklabel == SGI_LABEL) |