From eac511111f4e818d1002a64c3c94c33e90d860c9 Mon Sep 17 00:00:00 2001 From: infirit Date: Fri, 24 Oct 2014 16:41:39 +0200 Subject: Add error handling to glibtop_get_proc_uid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Author: Tomaž Šolc Based on commit: 4ecd6e49164ee027cee8dfdbb51fd8389694ff43 Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=603240 --- src/core/window-props.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/window-props.c b/src/core/window-props.c index 9aab46ea..8eff8d8a 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -399,8 +399,15 @@ owner_of_process (pid_t process, uid_t *result) glibtop_get_proc_uid (&process_details, process); - *result = process_details.uid; - return TRUE; + if (process_details.flags & (1L << GLIBTOP_PROC_UID_UID)) + { + *result = process_details.uid; + return TRUE; + } + else + { + return FALSE; + } #else /* I don't know, maybe we could do something hairy like see whether * /proc/$PID exists and who owns it, in case they have procfs. -- cgit v1.2.1