summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--console/ChangeLog6
-rw-r--r--console/console.c14
2 files changed, 14 insertions, 6 deletions
diff --git a/console/ChangeLog b/console/ChangeLog
index 2384c64b..6bfbe80d 100644
--- a/console/ChangeLog
+++ b/console/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2002-03-23 James A. Morrison <ja2morri@uwaterloo.ca>
* main.c (main): Use error, not fprintf and exit.
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);