]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sfdisk: leave on error
authorKarel Zak <kzak@redhat.com>
Fri, 10 Oct 2014 10:52:24 +0000 (12:52 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 10 Oct 2014 10:52:24 +0000 (12:52 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/sfdisk.8
disk-utils/sfdisk.c

index 8f905174f95d71f6b64f992b9cf424b6b772cfd3..029083fc913821df82844a2e8b13e98e52a591f8 100644 (file)
@@ -74,7 +74,7 @@ together with \fB\-\-verify\fR.
 .TP
 .BR \-\-part\-attrs " " \fIdevice\fR " " \fIpartno\fR " "[\fIattrs\fR]
 Change GPT partition attribute bits. If \fIattrs\fR no specified then print the current
-partition setting. The \fIattrs\fR is comma delimited list of bits. The currently
+partition setting. The \fIattrs\fR is comma or space delimited list of bits. The currently
 supported attribute bits are: RequiredPartiton, NoBlockIOProtocol, LegacyBIOSBootable
 and GUID specific bits in range from 48 to 63. For example string 
 "RequiredPartiton,50,51" sets three bits.
index 83b9cf57f1524eed7e6c4e094d2baa3c2fd3b68a..1be40caad4bd315494d4c1c3407a985a01f3a608 100644 (file)
@@ -1238,6 +1238,10 @@ 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 && partno >= 0) {       /* -N <partno>, modify partition */
                                rc = fdisk_set_partition(sf->cxt, partno, pa);
@@ -1248,7 +1252,7 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
                                rc = fdisk_add_partition(sf->cxt, pa, &cur_partno);
                                if (rc) {
                                        errno = -rc;
-                                       fdisk_warn(sf->cxt, _("failed to add partition"));
+                                       fdisk_warn(sf->cxt, _("Failed to add partition"));
                                }
                        }
 
@@ -1256,16 +1260,15 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
                                if (sf->interactive)
                                        sfdisk_print_partition(sf, cur_partno);
                                next_partno = cur_partno + 1;
-                       } else if (pa) {        /* error, drop partition from script */
+                       } else if (pa)          /* error, drop partition from script */
                                fdisk_table_remove_partition(tb, pa);
-                               if (rc == -ENOSPC) {
-                                       rc = SFDISK_DONE_ASK;
-                                       break;
-                               }
-                       }
                } else
                        fdisk_info(sf->cxt, _("Script header accepted."));
 
+               if (rc && !sf->interactive) {
+                       rc =  SFDISK_DONE_ABORT;
+                       break;
+               }
        } while (1);
 
        if (!sf->quiet && rc != SFDISK_DONE_ABORT) {