From 8b1f9fb522a918db5a9ada3f2dca2cba6bd045cb Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Tue, 17 Dec 2024 08:07:44 -0500 Subject: [PATCH] wsd: do not complain if process is reaped already When a process is already reaped, waitpid(3) will fail. Instead of blindly warning, we first check if the process or its zombie still exists. If neither is found, there is nothing to do, and therefore nothing to warn about. Change-Id: I4d2d35a58eb3cfe6b70b0d2593e62f4ee1015581 Signed-off-by: Ashod Nakashian --- common/SigUtil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/SigUtil.cpp b/common/SigUtil.cpp index fc16839c9e9c..e8856a3d91a5 100644 --- a/common/SigUtil.cpp +++ b/common/SigUtil.cpp @@ -179,7 +179,7 @@ void requestShutdown() return std::make_pair(ret, WTERMSIG(status)); } } - else if (pid > 0) + else if (pid > 0 && ::kill(pid, 0) == 0) // Don't complain if the process is reaped already. { // Log errno if we had a child pid we expected to reap. LOG_WRN("Failed to reap child process " << pid << " (" << Util::symbolicErrno(errno)