]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - disk-utils/cfdisk.c
Merge branch 'uuidv7' of https://github.com/t-8ch/util-linux
[thirdparty/util-linux.git] / disk-utils / cfdisk.c
index 9cf03464258a4bf7479a7f97468183345abe474a..7b61929614cfa61e5c9ce51cc78358217a6e7060 100644 (file)
@@ -211,14 +211,6 @@ static struct cfdisk_menuitem main_menuitems[] = {
        { 0, NULL, NULL }
 };
 
-/* extra partinfo in name:value pairs */
-struct cfdisk_extra {
-       char *name;
-       char *data;
-
-       struct list_head exs;
-};
-
 /* line and extra partinfo list_head */
 struct cfdisk_line {
        char                    *data;          /* line data */
@@ -2458,18 +2450,17 @@ static int main_menu_action(struct cfdisk *cf, int key)
        }
        case 'r': /* resize */
        {
-               struct fdisk_partition *npa, *next;
                uint64_t size, max_size, secs;
+               struct fdisk_partition *npa;
 
                if (fdisk_partition_is_freespace(pa) || !fdisk_partition_has_start(pa))
                        return -EINVAL;
 
-               size = fdisk_partition_get_size(pa);
-
-               /* is the next freespace? */
-               next = fdisk_table_get_partition(cf->table, cf->lines_idx + 1);
-               if (next && fdisk_partition_is_freespace(next))
-                       size += fdisk_partition_get_size(next);
+               rc = fdisk_partition_get_max_size(cf->cxt,
+                                                 fdisk_partition_get_partno(pa),
+                                                 &size);
+               if (rc)
+                       return rc;
 
                size *= fdisk_get_sector_size(cf->cxt);
                max_size = size;