summaryrefslogtreecommitdiffstats
path: root/fdisks/gpt.c
diff options
context:
space:
mode:
authorKarel Zak2012-12-04 18:03:35 +0100
committerKarel Zak2012-12-04 18:03:35 +0100
commite3443e8f19c2c7cdb23c2815c7565e8e24101e1b (patch)
tree241f42b8933e1c967874087e8f72d53003e3b32b /fdisks/gpt.c
parentfdisk: (gpt) align newly created partitions (diff)
downloadkernel-qcow2-util-linux-e3443e8f19c2c7cdb23c2815c7565e8e24101e1b.tar.gz
kernel-qcow2-util-linux-e3443e8f19c2c7cdb23c2815c7565e8e24101e1b.tar.xz
kernel-qcow2-util-linux-e3443e8f19c2c7cdb23c2815c7565e8e24101e1b.zip
fdisk: (gpt) check if the "First sector" is unused
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/gpt.c')
-rw-r--r--fdisks/gpt.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fdisks/gpt.c b/fdisks/gpt.c
index a22200272..9963315d9 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);