From 3423ce3039033e8bf54860a2b955fdf8c1f21be7 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 17 Aug 2007 12:59:41 -0400 Subject: add a vt monitor test, move getfd to sysdeps, add a check for the root user --- src/test-tty-idle-monitor.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/test-tty-idle-monitor.c') diff --git a/src/test-tty-idle-monitor.c b/src/test-tty-idle-monitor.c index 8517f75..725505d 100644 --- a/src/test-tty-idle-monitor.c +++ b/src/test-tty-idle-monitor.c @@ -41,6 +41,7 @@ #include #include "ck-tty-idle-monitor.h" +#include "ck-sysdeps.h" static void idle_changed_cb (CkTtyIdleMonitor *monitor, @@ -55,8 +56,6 @@ is_console (const char *device) { int fd; gboolean ret; - int kb_ok; - char arg; ret = FALSE; fd = open (device, O_RDONLY | O_NOCTTY); @@ -64,14 +63,7 @@ is_console (const char *device) goto out; } -#ifdef __linux__ - kb_ok = (ioctl (fd, KDGKBTYPE, &arg) == 0 - && ((arg == KB_101) || (arg == KB_84))); -#else - kb_ok = 1; -#endif - - ret = (isatty (fd) && kb_ok); + ret = ck_fd_is_a_console (fd); close (fd); -- cgit