From c4840cb2c913e3c9f51f7c17aafce10304a53d6e Mon Sep 17 00:00:00 2001 From: krw Date: Sat, 4 Mar 2023 23:09:15 +0000 Subject: [PATCH] Don't whine about invalid start/end values when starting to edit an unused GPT partition. --- sbin/fdisk/gpt.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c index ff8bdfa96f0..7f82960ead5 100644 --- a/sbin/fdisk/gpt.c +++ b/sbin/fdisk/gpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpt.c,v 1.84 2023/03/04 14:47:18 krw Exp $ */ +/* $OpenBSD: gpt.c,v 1.85 2023/03/04 23:09:15 krw Exp $ */ /* * Copyright (c) 2015 Markus Muller * Copyright (c) 2015 Kenneth R Westerback @@ -481,11 +481,13 @@ GPT_print_part(const unsigned int pn, const char *units, const int verbosity) } } - if (start > end) - printf("partition %u first LBA is > last LBA\n", pn); - if (start < gh.gh_lba_start || end > gh.gh_lba_end) - printf("partition %u extends beyond usable LBA range of %s\n", - pn, disk.dk_name); + if (uuid_is_nil(&gp[pn].gp_type, NULL) == 0) { + if (start > end) + printf("partition %u first LBA is > last LBA\n", pn); + if (start < gh.gh_lba_start || end > gh.gh_lba_end) + printf("partition %u extends beyond usable LBA range " + "of %s\n", pn, disk.dk_name); + } } int -- 2.20.1