From 9f17b992e37fc41ff7abfdb6ee94dd03d4431a37 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 19 Apr 2021 13:19:23 +0200 Subject: [PATCH] libfdisk: do not reset default if undefined by script Signed-off-by: Karel Zak --- libfdisk/src/gpt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index 1a086a61d8..97b161312e 100644 --- a/libfdisk/src/gpt.c +++ b/libfdisk/src/gpt.c @@ -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; } -- 2.47.2