libfdisk: do not reset default if undefined by script

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2021-04-19 13:19:23 +02:00
parent 35d5db6ebb
commit 9f17b992e3
1 changed files with 3 additions and 1 deletions

View 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;
}