diff options
author | Toomas Soome <tsoome@me.com> | 2022-03-23 13:26:06 +0200 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2022-07-12 17:25:30 +0300 |
commit | 20e6de55ab1d426790ba858431f38b11e499c967 (patch) | |
tree | ef171981d970ad7ec137a085aaf94a389c96b304 /usr/src/boot | |
parent | db6ea8e69c35f1dac85a7e12505787c1212108b2 (diff) | |
download | illumos-gate-20e6de55ab1d426790ba858431f38b11e499c967.tar.gz |
14585 loader: should preserve order of console device list
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src/boot')
-rw-r--r-- | usr/src/boot/Makefile.version | 2 | ||||
-rw-r--r-- | usr/src/boot/common/console.c | 33 |
2 files changed, 33 insertions, 2 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 3f11cd86eb..30812e2f31 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -34,4 +34,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2022.07.04.1 +BOOT_VERSION = $(LOADER_VERSION)-2022.07.11.1 diff --git a/usr/src/boot/common/console.c b/usr/src/boot/common/console.c index 0472ae7645..8ef67d53d6 100644 --- a/usr/src/boot/common/console.c +++ b/usr/src/boot/common/console.c @@ -185,6 +185,7 @@ cons_set(struct env_var *ev, int flags, const void *value) { int ret, cons; char *list, *tmp; + const char *console; if ((value == NULL) || (cons_check(value) == 0)) { /* @@ -201,9 +202,39 @@ cons_set(struct env_var *ev, int flags, const void *value) /* * build list of active consoles. + * Note, we need to preserve the ordered device list in 'value'. */ list = NULL; - for (cons = 0; consoles[cons] != NULL; cons++) { + console = value; + while (console[0] != '\0') { + /* Find corresponding entry from consoles array. */ + for (cons = 0; consoles[cons] != NULL; cons++) { + const char *name = consoles[cons]->c_name; + size_t len = strlen(name); + + if (strncmp(name, console, len) != 0) + continue; + len++; + if (console[len] == ',' || + console[len] == ' ' || + console[len] == '\0') { + break; + } + } + + /* Skip to delimiter */ + while (console[0] != ',' && + console[0] != ' ' && + console[0] != '\0') + console++; + /* Skip to next name */ + while (console[0] == ',' || console[0] == ' ') + console++; + + /* no such console? */ + if (consoles[cons] == NULL) + continue; + if ((consoles[cons]->c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) == (C_ACTIVEIN | C_ACTIVEOUT)) { if (list == NULL) { |