From c0c74f8064392598cd29401142804fcc241841ed Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 17 Aug 2007 10:52:19 -0400 Subject: a few fixes for peer cred stuff --- tools/ck-get-x11-display-device.c | 13 ++++++------- tools/ck-get-x11-server-pid.c | 4 +++- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'tools') 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 #include -#include -#include -#include #include #include @@ -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); + } } } -- cgit