[PATCH 09/13] fdisk: don't use get_existing_partition() if disk label isn't dos

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Francesco Cosoleto <cosoleto@xxxxxxxxx>
---
 fdisk/fdisk.c |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 8f5869d..53eed25 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;
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux