From e3443e8f19c2c7cdb23c2815c7565e8e24101e1b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 4 Dec 2012 18:03:35 +0100 Subject: [PATCH] fdisk: (gpt) check if the "First sector" is unused Signed-off-by: Karel Zak --- fdisks/gpt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fdisks/gpt.c b/fdisks/gpt.c index a222002721..9963315d9b 100644 --- a/fdisks/gpt.c +++ b/fdisks/gpt.c @@ -1530,7 +1530,12 @@ static int gpt_add_partition(struct fdisk_context *cxt, int partnum, 0, _("First sector")); if (user_f < disk_f || user_f > disk_l) + continue; /* bug in read_int() dialog? */ + + if (user_f != find_first_available(pheader, ents, user_f)) { + printf(_("Sector %ju already used\n"), user_f); continue; + } /* Last sector */ dflt_l = find_last_free(pheader, ents, user_f); -- 2.47.2