diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-06-29 15:43:20 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-07-14 13:49:34 +1000 |
commit | 7e6dd06b20beda18d07ce725e4d8c4473d10d902 (patch) | |
tree | 9fc959e26e92337011c21202517692cafbc96112 /discover | |
parent | 6a6d2c94bd5c001750e8eaa133a61a87964efa70 (diff) | |
download | petitboot-7e6dd06b20beda18d07ce725e4d8c4473d10d902.zip petitboot-7e6dd06b20beda18d07ce725e4d8c4473d10d902.tar.gz |
discover/device-handler: Remove default option if device removedv1.2.1
If one of a device's boot options is the current default boot option,
make sure the default boot is cancelled before the device is removed.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'discover')
-rw-r--r-- | discover/device-handler.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c index e230e76..682a4e9 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -359,6 +359,15 @@ void device_handler_remove(struct device_handler *handler, struct discover_boot_option *opt, *tmp; unsigned int i; + list_for_each_entry_safe(&device->boot_options, opt, tmp, list) { + if (opt == handler->default_boot_option) { + pb_log("Default option %s cancelled since device removed", + opt->option->name); + device_handler_cancel_default(handler); + break; + } + } + for (i = 0; i < handler->n_devices; i++) if (handler->devices[i] == device) break; |