diff options
author | William Jon McCann <mccann@jhu.edu> | 2007-08-17 12:59:41 -0400 |
---|---|---|
committer | William Jon McCann <mccann@jhu.edu> | 2007-08-17 12:59:41 -0400 |
commit | 3423ce3039033e8bf54860a2b955fdf8c1f21be7 (patch) | |
tree | f9da817b4799d19e28c673e1e26d7a42f94fcde9 /src/test-tty-idle-monitor.c | |
parent | bec4b4163ae65fa271845da6b748456346987c26 (diff) |
add a vt monitor test, move getfd to sysdeps, add a check for the root user
Diffstat (limited to 'src/test-tty-idle-monitor.c')
-rw-r--r-- | src/test-tty-idle-monitor.c | 12 |
1 files changed, 2 insertions, 10 deletions
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 <glib.h> #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); |