From d9b0269d59a00329feb19b6e65b10a233a3dd414 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Mon, 29 Apr 2019 14:34:32 -0500 Subject: [PATCH] Low: libcrmcommon: return proper code if testing pid is denied 7dda20d avoided a use-of-NULL in an unlikely corner case, but returned the wrong code in that case. --- lib/common/pid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common/pid.c b/lib/common/pid.c index 4fbf2dd..ccee03f 100644 --- a/lib/common/pid.c +++ b/lib/common/pid.c @@ -47,7 +47,7 @@ crm_pid_active(long pid, const char *daemon) } else if ((rc = kill(pid, 0)) < 0 && errno == ESRCH) { return 0; /* no such PID detected */ - } else if (rc < 0 && have_proc_pid == -1) { + } else if (rc < 0 && (daemon == NULL || have_proc_pid == -1)) { if (last_asked_pid != pid) { crm_info("Cannot examine PID %ld: %s", pid, strerror(errno)); last_asked_pid = pid; -- 1.8.3.1