diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-10-23 16:57:10 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-10-23 16:57:10 +0000 |
commit | 2a95de90da8deb3bce8d0b7e322530d4e87a06a5 (patch) | |
tree | d737fd11eb4df0de21ebf33b9d2ac87a23fb1146 /usr.sbin | |
parent | 826b7ad94b28bfd2eab6901334be23f2a3f87206 (diff) | |
download | FreeBSD-src-2a95de90da8deb3bce8d0b7e322530d4e87a06a5.zip FreeBSD-src-2a95de90da8deb3bce8d0b7e322530d4e87a06a5.tar.gz |
Avoid some "Invalid argument" errors in the installer.
PR: bin/161926
MFC after: 5 days
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bsdinstall/partedit/gpart_ops.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c index e9c73d2..52f145e 100644 --- a/usr.sbin/bsdinstall/partedit/gpart_ops.c +++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c @@ -392,8 +392,14 @@ gpart_destroy(struct ggeom *lg_geom) gctl_ro_param(r, "force", sizeof(force), &force); gctl_ro_param(r, "verb", -1, "destroy"); errstr = gctl_issue(r); - if (errstr != NULL && errstr[0] != '\0') - gpart_show_error("Error", NULL, errstr); + if (errstr != NULL && errstr[0] != '\0') { + /* + * Check if we reverted away the existence of the geom + * altogether. Show all other errors to the user. + */ + if (strtol(errstr, NULL, 0) != EINVAL) + gpart_show_error("Error", NULL, errstr); + } gctl_free(r); /* And any metadata associated with the partition scheme itself */ @@ -450,6 +456,10 @@ gpart_edit(struct gprovider *pp) return; } + /* If this is a nested partition, edit as usual */ + if (strcmp(pp->lg_geom->lg_class->lg_name, "PART") == 0) + break; + /* Destroy the geom and all sub-partitions */ gpart_destroy(cp->lg_geom); @@ -507,7 +517,7 @@ editpart: choice = dlg_form("Edit Partition", "", 0, 0, 0, nitems, items, &junk); if (choice) /* Cancel pressed */ - return; + goto endedit; /* Check if the label has a / in it */ if (strchr(items[3].text, '/') != NULL) { @@ -538,6 +548,13 @@ editpart: items[2].text, (strcmp(oldtype, items[0].text) != 0) ? newfs : NULL); +endedit: + if (strcmp(oldtype, items[0].text) != 0 && cp != NULL) + gpart_destroy(cp->lg_geom); + if (strcmp(oldtype, items[0].text) != 0 && strcmp(items[0].text, + "freebsd") == 0) + gpart_partition(pp->lg_name, "BSD"); + for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++) if (items[i].text_free) free(items[i].text); |