discover/device-handler: Treat empty boot order as 'boot any'
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 29 Jan 2018 03:21:47 +0000 (14:21 +1100)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 12 Feb 2018 02:47:15 +0000 (13:47 +1100)
It is possible to have autoboot enabled with an empty boot order.
Currently this acts as if autoboot is disabled, but it likely makes more
sense to the user for this to behave as "autoboot any device".

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
discover/device-handler.c
ui/ncurses/nc-config.c

index 7a570f9e612da52ff7d098ee2e7ec8ac6eb3bb23..a6eb8843d514e0a99f9a53bb79ea951e8ec6f36a 100644 (file)
@@ -832,6 +832,9 @@ static enum default_priority default_option_priority(
                int boot_match = autoboot_option_priority(config, opt);
                if (boot_match > 0)
                        return boot_match;
+       } else {
+               /* If there is no specific boot order, boot any device */
+               return DEFAULT_PRIORITY_LOCAL_FIRST;
        }
 
        /* If the option didn't match any entry in the array, it is disabled */
index 58bae290c23d03686b27d116a70a6d4eb1c7d577..8ffa5ef0d2ffadc92d2b9c6570a09cc7c1ea0e60 100644 (file)
@@ -203,7 +203,7 @@ 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;
-       bool allow_write, autoboot;
+       bool allow_write;
        char *str, *end;
        struct config *config;
        int i, n_boot_opts, rc;
@@ -218,8 +218,8 @@ static int screen_process_form(struct config_screen *screen)
        n_boot_opts = widget_subset_get_order(config, &order,
                                              screen->widgets.boot_order_f);
 
-       autoboot = widget_select_get_value(screen->widgets.autoboot_f);
-       config->autoboot_enabled = autoboot && n_boot_opts;
+       config->autoboot_enabled = widget_select_get_value(
+                                               screen->widgets.autoboot_f);
 
        config->n_autoboot_opts = n_boot_opts;
        config->autoboot_opts = talloc_array(config, struct autoboot_option,