summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-03-16 18:13:58 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-03-16 18:13:58 +0100
commit4097daba7e43b3a1a3af77a715da1a2418d30392 (patch)
tree8570af8b33455e9f917be4d0c4adff8830587f1a
parent666830d8a75a3676f60b48028b115edb19d06cc7 (diff)
Fix crash on opening /dev/kbd or mouse without any console being active
* console-client/console.c (console_switch_away): Check for `active_vcons` being NULL before saving the currently active console.
-rw-r--r--console-client/console.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/console-client/console.c b/console-client/console.c
index 2fb2fbeb..2fa05339 100644
--- a/console-client/console.c
+++ b/console-client/console.c
@@ -226,10 +226,17 @@ console_switch_away (void)
if (driver->ops->save_status)
driver->ops->save_status (driver->handle);
- saved_id = active_vcons->id;
- saved_cons = active_vcons->cons;
- cons_vcons_close (active_vcons);
- active_vcons = NULL;
+ if (active_vcons)
+ {
+ saved_id = active_vcons->id;
+ saved_cons = active_vcons->cons;
+ cons_vcons_close (active_vcons);
+ active_vcons = NULL;
+ }
+ else
+ {
+ saved_cons = NULL;
+ }
pthread_mutex_unlock (&global_lock);
}