diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2014-09-18 19:21:00 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-09-18 19:21:00 +0800 |
commit | 29f9a3a7e503f731fe891d21bedf29c08a20383f (patch) | |
tree | 130aaf215a02078cd5f4e6be86d06947ad3d7364 /ui | |
parent | 3c173e909de0db1b2dd96b1d57851abb35bbdbc4 (diff) | |
download | petitboot-29f9a3a7e503f731fe891d21bedf29c08a20383f.zip petitboot-29f9a3a7e503f731fe891d21bedf29c08a20383f.tar.gz |
ui/ncurses: Fix clearing a boot device UUID
Currently, we have a bug where we can't clear a boot device UUID, as we
only update config->boot_device if we're in AUTOBOOT_ONE state. This
means that the config UI can't be used to change out of "autoboot from a
single device" mode.
This sets the autoboot device unconditionally, allowing it to be
cleared.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ncurses/nc-config.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c index 4b1a58f..f6d544d 100644 --- a/ui/ncurses/nc-config.c +++ b/ui/ncurses/nc-config.c @@ -188,8 +188,8 @@ static int screen_process_form(struct config_screen *screen) const struct system_info *sysinfo = screen->cui->sysinfo; enum net_conf_type net_conf_type; struct interface_config *iface; + char *str, *end, *uuid; struct config *config; - char *str, *end; int rc, idx; config = config_copy(screen, screen->cui->config); @@ -199,8 +199,9 @@ static int screen_process_form(struct config_screen *screen) config->autoboot_enabled = screen->autoboot_type != AUTOBOOT_DISABLED; + uuid = NULL; if (screen->autoboot_type == AUTOBOOT_ONE) { - char mac[20], *uuid = NULL; + char mac[20]; /* if idx is -1 here, we have an unknown UUID selected. * Otherwise, it's a blockdev index (idx <= n_blockdevs) or an @@ -216,13 +217,11 @@ static int screen_process_form(struct config_screen *screen) } else if (idx != -1) { uuid = sysinfo->blockdevs[idx]->uuid; } - - if (uuid) { - talloc_free(config->boot_device); - config->boot_device = talloc_strdup(config, uuid); - } } + talloc_free(config->boot_device); + config->boot_device = uuid ? talloc_strdup(config, uuid) : NULL; + str = widget_textbox_get_value(screen->widgets.timeout_f); if (str) { unsigned long x; |