]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: do not reset default if undefined by script
authorKarel Zak <kzak@redhat.com>
Mon, 19 Apr 2021 11:19:23 +0000 (13:19 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 19 Apr 2021 11:19:23 +0000 (13:19 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/gpt.c

index 1a086a61d8fbb891758895a1f6beb2027f812fb1..97b161312e59f0ee465840d89904278c71b33f09 100644 (file)
@@ -758,7 +758,9 @@ static int count_first_last_lba(struct fdisk_context *cxt,
        /* Get the table length from the script, if given */
        if (cxt->script) {
                rc = get_script_u64(cxt, &nents, "table-length");
-               if (rc < 0)
+               if (rc == 1)
+                       nents = GPT_NPARTITIONS;  /* undefined by script */
+               else if (rc < 0)
                        return rc;
        }