From: Karel Zak Date: Fri, 3 Nov 2017 18:34:49 +0000 (+0100) Subject: sfdisk: create empty label on 'write' command X-Git-Tag: v2.31.1~41 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=0ce8df8c84249008ef830112cb9bf96ddd0e1c6a;p=thirdparty%2Futil-linux.git sfdisk: create empty label on 'write' command Addresses: https://github.com/karelzak/util-linux/issues/528 Signed-off-by: Karel Zak --- diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c index 0cca4ebe04..ea0e8b124d 100644 --- a/disk-utils/sfdisk.c +++ b/disk-utils/sfdisk.c @@ -1766,7 +1766,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")) {