aboutsummaryrefslogtreecommitdiffstats
path: root/disk-utils/sfdisk.c
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2020-09-30 11:49:05 +0200
committerKarel Zak <kzak@redhat.com>2020-09-30 11:49:05 +0200
commit134b6296e390c7761730a36b9f3bfb08d289215e (patch)
treee783721076ce5bae1e29b6fa6364418afbd68109 /disk-utils/sfdisk.c
parentffac9652c737b97069732a6a2b1eae8d3db40d57 (diff)
downloadutil-linux-134b6296e390c7761730a36b9f3bfb08d289215e.tar.gz
fdisk: always report fdisk_create_disklabel() errors
This is fdisk, cfdisk and sfdisk change to inform user about fdisk_create_disklabel() issues. Addresses: https://github.com/karelzak/util-linux/issues/1147 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/sfdisk.c')
-rw-r--r--disk-utils/sfdisk.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index 192e9f951e..54d3b60e71 100644
--- a/disk-utils/sfdisk.c
+++ b/disk-utils/sfdisk.c
@@ -1890,10 +1890,11 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
if (!created) { /* create a new disklabel */
rc = fdisk_apply_script_headers(sf->cxt, dp);
created = !rc;
- if (rc)
- fdisk_warnx(sf->cxt, _(
- "Failed to apply script headers, "
- "disk label not created."));
+ if (rc) {
+ errno = -rc;
+ fdisk_warn(sf->cxt, _(
+ "Failed to apply script headers, disk label not created"));
+ }
if (rc == 0 && fdisk_get_collision(sf->cxt))
follow_wipe_mode(sf);