sfdisk: create empty label on 'write' command

Addresses: https://github.com/karelzak/util-linux/issues/528
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2017-11-03 19:34:49 +01:00
parent b412e860b5
commit 9d4081cd6d
1 changed files with 1 additions and 1 deletions

View File

@ -1776,7 +1776,7 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
} while (1);
/* create empty disk label if label, but no partition specified */
if (rc == SFDISK_DONE_EOF && created == 0
if ((rc == SFDISK_DONE_EOF || rc == SFDISK_DONE_WRITE) && created == 0
&& fdisk_script_has_force_label(dp) == 1
&& fdisk_table_get_nents(tb) == 0
&& fdisk_script_get_header(dp, "label")) {