From 4403a2905d4de08686ed3549c9d0282f29b47f50 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Tue, 5 Jul 2011 12:58:11 +1000 Subject: Fix usage of VT_ACTIVATE --- src/vt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/vt.c b/src/vt.c index 93e90638..66f4802d 100644 --- a/src/vt.c +++ b/src/vt.c @@ -42,7 +42,7 @@ vt_get_active (void) gint active = -1; console_fd = open_console (); - if (console_fd) + if (console_fd >= 0) { struct vt_stat console_state = { 0 }; if (ioctl (console_fd, VT_GETSTATE, &console_state) < 0) @@ -112,12 +112,14 @@ vt_set_active (gint number) #ifdef __linux__ gint console_fd; + g_debug ("Activating VT %d", number); + console_fd = open_console (); - if (console_fd) + if (console_fd >= 0) { int n = number; - if (ioctl (console_fd, VT_ACTIVATE, &n) < 0) - g_warning ("Error using VT_ACTIVATE on /dev/console: %s", strerror (errno)); + if (ioctl (console_fd, VT_ACTIVATE, n) < 0) + g_warning ("Error using VT_ACTIVATE %d on /dev/console: %s", n, strerror (errno)); close (console_fd); } #endif -- cgit v1.2.3