diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ck-get-x11-display-device.c | 13 | ||||
-rw-r--r-- | tools/ck-get-x11-server-pid.c | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/tools/ck-get-x11-display-device.c b/tools/ck-get-x11-display-device.c index 723d239..b349cc7 100644 --- a/tools/ck-get-x11-display-device.c +++ b/tools/ck-get-x11-display-device.c @@ -25,9 +25,6 @@ #include <stdlib.h> #include <stdio.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/socket.h> #include <X11/Xlib.h> #include <glib.h> @@ -116,10 +113,12 @@ main (int argc, ret = 0; res = ck_get_socket_peer_credentials (fd, &pid, NULL, NULL); if (res) { - device = get_tty_for_pid (pid); - if (device != NULL) { - printf ("%s\n", device); - g_free (device); + if (pid > 0) { + device = get_tty_for_pid (pid); + if (device != NULL) { + printf ("%s\n", device); + g_free (device); + } } } } diff --git a/tools/ck-get-x11-server-pid.c b/tools/ck-get-x11-server-pid.c index eedb9af..3324164 100644 --- a/tools/ck-get-x11-server-pid.c +++ b/tools/ck-get-x11-server-pid.c @@ -77,7 +77,9 @@ main (int argc, ret = 0; res = ck_get_socket_peer_credentials (fd, &pid, NULL, NULL); if (res) { - printf ("%u\n", pid); + if (pid > 0) { + printf ("%d\n", pid); + } } } |