From c04f4d2ad369bcd6ddfefd8424991432a9374695 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sun, 2 Jun 2002 02:36:10 +0000 Subject: 2002-06-02 Marcus Brinkmann * console.c (vcons_lookup): Correct nesting. (vcons_release): Negate if condition. Delete VCONS_LIST in CONS with last virtual console. --- console/console.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'console/console.c') diff --git a/console/console.c b/console/console.c index ac7c807d..0f4ca22e 100644 --- a/console/console.c +++ b/console/console.c @@ -161,11 +161,11 @@ vcons_lookup (cons_t cons, int id, int create, vcons_t *r_vcons) *r_vcons = previous_cons; return 0; } - else if (!create) - { - mutex_unlock (&cons_list_lock); - return ESRCH; - } + } + else if (!create) + { + mutex_unlock (&cons_list_lock); + return ESRCH; } } else @@ -236,7 +236,7 @@ void vcons_release (vcons_t vcons) { mutex_lock (&cons_list_lock); - if (--vcons->refcnt) + if (!--vcons->refcnt) { /* As we keep a reference for all input focus groups pointing to the virtual console, and a reference for the active console, @@ -250,6 +250,8 @@ vcons_release (vcons_t vcons) vcons->prev->next = vcons->next; if (vcons->next) vcons->next->prev = vcons->prev; + if (!vcons->prev && !vcons->next) + vcons->cons->vcons_list = NULL; vcons->cons->vcons_length--; vcons->cons->refcnt--; free (vcons); -- cgit v1.2.3