summaryrefslogtreecommitdiff
path: root/console/console.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-06-02 02:36:10 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-06-02 02:36:10 +0000
commitc04f4d2ad369bcd6ddfefd8424991432a9374695 (patch)
tree5f979a4de0a62aac58256972cba21338ea6a64ad /console/console.c
parente46ec2a51f0f4650b655a642baaff12847a413b5 (diff)
2002-06-02 Marcus Brinkmann <marcus@gnu.org>
* console.c (vcons_lookup): Correct nesting. (vcons_release): Negate if condition. Delete VCONS_LIST in CONS with last virtual console.
Diffstat (limited to 'console/console.c')
-rw-r--r--console/console.c14
1 files changed, 8 insertions, 6 deletions
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);