]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: (dos) use libfdisk to ask for partition type
authorKarel Zak <kzak@redhat.com>
Wed, 26 Jun 2013 06:54:01 +0000 (08:54 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Sep 2013 14:47:04 +0000 (16:47 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdiskdoslabel.c

index 7b1391786b87cb60487b36a785d48e273a36ba78..e4ee6a4fbc0c6448589cffb359d4d82d9f304cf1 100644 (file)
@@ -15,6 +15,8 @@
 
 #include "fdiskdoslabel.h"
 
+#include <ctype.h>
+
 #define MAXIMUM_PARTS  60
 #define ACTIVE_FLAG     0x80
 
@@ -1203,7 +1205,7 @@ static int dos_add_partition(
                if (j >= 0)
                        rc = add_partition(cxt, j, t);
        } else {
-               char buf[16];
+               char *buf;
                char c, prompt[BUFSIZ];
                int dflt;
 
@@ -1213,13 +1215,13 @@ static int dos_add_partition(
                         _("Partition type:\n"
                           "   p   primary (%zd primary, %d extended, %zd free)\n"
                           "%s\n"
-                          "Select (default %c)"),
+                          "Select (default %c)"),
                         4 - (l->ext_offset ? 1 : 0) - free_primary,
                         l->ext_offset ? 1 : 0, free_primary,
                         l->ext_offset ? _("   l   logical (numbered from 5)") : _("   e   extended"),
                         dflt);
 
-               rc = get_user_reply(cxt, prompt, buf, sizeof(buf));
+               rc = fdisk_ask_string(cxt, prompt, &buf);
                if (rc)
                        return rc;
                if (!buf[0]) {
@@ -1227,6 +1229,7 @@ static int dos_add_partition(
                        fdisk_info(cxt, _("Using default response %c"), c);
                } else
                        c = tolower(buf[0]);
+               free(buf);
 
                if (c == 'p') {
                        int j = get_partition_unused_primary(cxt);