summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-11-14 14:15:15 +0200
committerToomas Soome <tsoome@me.com>2020-11-23 20:50:39 +0200
commit560dcad7f6059e242335a94501511eae11b1308a (patch)
treee72850f5dd1dc8ecb2da8408fa78b41882a66af8
parent18425b359c7d1e5f7f63fae3ca5245407223a45b (diff)
downloadillumos-joyent-560dcad7f6059e242335a94501511eae11b1308a.tar.gz
13314 loader: make sure console variable has usable consoles
Reviewed by: Andy Fiddaman <andy@omnios.org> Approved by: Robert Mustacchi <rm@fingolfin.org>
-rw-r--r--usr/src/boot/Makefile.version2
-rw-r--r--usr/src/boot/sys/boot/common/console.c34
2 files changed, 33 insertions, 3 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version
index 2740ae8932..baade5b6c4 100644
--- a/usr/src/boot/Makefile.version
+++ b/usr/src/boot/Makefile.version
@@ -33,4 +33,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)-2020.10.16.1
+BOOT_VERSION = $(LOADER_VERSION)-2020.11.14.1
diff --git a/usr/src/boot/sys/boot/common/console.c b/usr/src/boot/sys/boot/common/console.c
index ec4c4b050b..0472ae7645 100644
--- a/usr/src/boot/sys/boot/common/console.c
+++ b/usr/src/boot/sys/boot/common/console.c
@@ -183,7 +183,8 @@ cons_find(const char *name)
static int
cons_set(struct env_var *ev, int flags, const void *value)
{
- int ret;
+ int ret, cons;
+ char *list, *tmp;
if ((value == NULL) || (cons_check(value) == 0)) {
/*
@@ -198,7 +199,36 @@ cons_set(struct env_var *ev, int flags, const void *value)
if (ret != CMD_OK)
return (ret);
- env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
+ /*
+ * build list of active consoles.
+ */
+ list = NULL;
+ for (cons = 0; consoles[cons] != NULL; cons++) {
+ if ((consoles[cons]->c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) ==
+ (C_ACTIVEIN | C_ACTIVEOUT)) {
+ if (list == NULL) {
+ list = strdup(consoles[cons]->c_name);
+ } else {
+ if (asprintf(&tmp, "%s,%s", list,
+ consoles[cons]->c_name) > 0) {
+ free(list);
+ list = tmp;
+ }
+ }
+ }
+ }
+
+ /*
+ * set console variable.
+ */
+ if (list != NULL) {
+ (void) env_setenv(ev->ev_name, flags | EV_NOHOOK, list,
+ NULL, NULL);
+ } else {
+ (void) env_setenv(ev->ev_name, flags | EV_NOHOOK, value,
+ NULL, NULL);
+ }
+ free(list);
return (CMD_OK);
}