diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-10-25 16:30:16 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-10-25 16:30:16 +0000 |
commit | afe77a15ac76058e7f1725e7ba0ccc6e9a314d87 (patch) | |
tree | 9c742236dab3c1bf993f92dbcccb20daa3292595 | |
parent | 5179da9b9478003bed041c9a484b8f661ab71fb1 (diff) | |
download | FreeBSD-src-afe77a15ac76058e7f1725e7ba0ccc6e9a314d87.zip FreeBSD-src-afe77a15ac76058e7f1725e7ba0ccc6e9a314d87.tar.gz |
Provide an error message instead of silent failure if no disks are present
in the system.
PR: bin/161950
MFC after: 3 days
-rw-r--r-- | usr.sbin/bsdinstall/partedit/partedit.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/usr.sbin/bsdinstall/partedit/partedit.c b/usr.sbin/bsdinstall/partedit/partedit.c index 8a89f52..cddf790 100644 --- a/usr.sbin/bsdinstall/partedit/partedit.c +++ b/usr.sbin/bsdinstall/partedit/partedit.c @@ -70,7 +70,7 @@ main(int argc, const char **argv) { struct partition_metadata *md; const char *prompt; - struct partedit_item *items; + struct partedit_item *items = NULL; struct gmesh mesh; int i, op, nitems, nscroll; int error; @@ -99,12 +99,21 @@ main(int argc, const char **argv) /* Show the part editor either immediately, or to confirm wizard */ while (1) { - error = geom_gettree(&mesh); - items = read_geom_mesh(&mesh, &nitems); - get_mount_points(items, nitems); dlg_clear(); dlg_put_backtitle(); + error = geom_gettree(&mesh); + if (error == 0) + items = read_geom_mesh(&mesh, &nitems); + if (error || items == NULL) { + dialog_msgbox("Error", "No disks found. If you need to " + "install a kernel driver, choose Shell at the " + "installation menu.", 0, 0, TRUE); + break; + } + + get_mount_points(items, nitems); + if (i >= nitems) i = nitems - 1; op = diskeditor_show("Partition Editor", prompt, |