DetermineClientPid didn't close file descriptor if read on /proc/pid/cmdline failed. Adjusted the code to disregard the close return value and perform the return after that, if the read failed or returned EOF.
Signed-off-by: Mark Kettenis <[email protected]> Signed-off-by: Erkki Seppälä <[email protected]> Reviewed-by: Rami Ylimäki <[email protected]> --- os/client.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/os/client.c b/os/client.c index 1311855..b534977 100644 --- a/os/client.c +++ b/os/client.c @@ -140,10 +140,9 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs) /* Read the contents of /proc/pid/cmdline. It should contain the * process name and arguments. */ totsize = read(fd, path, sizeof(path)); + close(fd); if (totsize <= 0) return; - if (close(fd) < 0) - return; path[totsize - 1] = '\0'; /* Contruct the process name without arguments. */ -- 1.7.0.4 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
