]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: (gpt) check if the "First sector" is unused
authorKarel Zak <kzak@redhat.com>
Tue, 4 Dec 2012 17:03:35 +0000 (18:03 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 4 Dec 2012 17:03:35 +0000 (18:03 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/gpt.c

index a222002721a2c3239538c3eb8e4550c1889d50fa..9963315d9bbbc413433e5c7619a23ec504cd4b8a 100644 (file)
@@ -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);