]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sfdisk: create empty label on 'write' command
authorKarel Zak <kzak@redhat.com>
Fri, 3 Nov 2017 18:34:49 +0000 (19:34 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 3 Nov 2017 18:34:49 +0000 (19:34 +0100)
Addresses: https://github.com/karelzak/util-linux/issues/528
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/sfdisk.c

index ac4f711066b1a5952e7512409f27c385111b54de..d769ed8db091f33ba908b385163fb8b64a097c77 100644 (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")) {