From cf527c6873b86266ab75e56f28e2eada23866296 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 12 Jun 2016 20:57:41 -0400 Subject: [PATCH 1/1] process-util: remove broken support for pid==0 Our functions that query /proc/pid/ support using pid==0 to mean self. get_process_id also seemed to support that, but it was not implemented correctly: the result should be in *uid, not returned, and also it gave completely bogus result when called from get_process_gid(). But afaict, get_process_{uid,gid} were never called with pid==0, so it's not an actual bug. Remove the broken code to avoid confusion. --- src/basic/process-util.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/basic/process-util.c b/src/basic/process-util.c index f418b85b9..faadb756c 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -321,9 +321,6 @@ static int get_process_id(pid_t pid, const char *field, uid_t *uid) { assert(field); assert(uid); - if (pid == 0) - return getuid(); - p = procfs_file_alloca(pid, "status"); f = fopen(p, "re"); if (!f) { -- 2.30.2