diff options
author | William Jon McCann <mccann@jhu.edu> | 2007-08-17 10:52:19 -0400 |
---|---|---|
committer | William Jon McCann <mccann@jhu.edu> | 2007-08-17 10:52:19 -0400 |
commit | c0c74f8064392598cd29401142804fcc241841ed (patch) | |
tree | 3864ce14bba2c6e6ecb0beb2eac7f0e46d5d92f2 /tools | |
parent | 577099aea3ed75c1298d7a4cfa32784a1800bb09 (diff) |
a few fixes for peer cred stuff
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); + } } } |