Page MenuHomeFreeBSD

D43324.1794759583.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D43324.1794759583.diff

diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c
--- a/sys/kern/kern_cons.c
+++ b/sys/kern/kern_cons.c
@@ -239,15 +239,31 @@
{
struct cn_device *cnd;
int i;
+ bool primary = true;
STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) {
- if (cnd->cnd_cn != cn)
+ if (cnd->cnd_cn != cn) {
+ primary = false;
continue;
- if (STAILQ_FIRST(&cn_devlist) == cnd)
- ttyconsdev_select(NULL);
+ }
+
STAILQ_REMOVE(&cn_devlist, cnd, cn_device, cnd_next);
cnd->cnd_cn = NULL;
+ /*
+ * We only need to select a new console if we've removed all
+ * consoles or if we're removing the primary console.
+ */
+ if (primary) {
+ struct cn_device *next;
+
+ next = STAILQ_FIRST(&cn_devlist);
+ if (next == NULL)
+ ttyconsdev_select(NULL);
+ else
+ ttyconsdev_select(next->cnd_cn->cn_name);
+ }
+
/* Remove this device from available mask. */
for (i = 0; i < CNDEVTAB_SIZE; i++)
if (cnd == &cn_devtab[i]) {
@@ -356,8 +372,6 @@
error = 0;
} else {
error = cnadd(cp);
- if (error == 0)
- cnselect(cp);
}
break;
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 15, 4:19 PM (15 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41745160
Default Alt Text
D43324.1794759583.diff (1 KB)

Event Timeline