From 51dcac5da7ca020eaf8a73f6f16a8a9f8f178179 Mon Sep 17 00:00:00 2001 From: Wayne Zhang Date: Wed, 25 May 2022 09:12:57 -0400 Subject: [PATCH] zos: don't err when killing a zombie process (#3625) On z/OS, EPERM is returned if the process being killed is a zombie. However, this shouldn't be treated as an error, so return 0 instead. Co-authored-by: Muntasir Mallick Co-authored-by: Gaby Baghdadi --- src/unix/process.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/unix/process.c b/src/unix/process.c index 3a1b5b747..f84153687 100644 --- a/src/unix/process.c +++ b/src/unix/process.c @@ -1063,9 +1063,16 @@ int uv_process_kill(uv_process_t* process, int signum) { int uv_kill(int pid, int signum) { - if (kill(pid, signum)) + if (kill(pid, signum)) { +#if defined(__MVS__) + /* EPERM is returned if the process is a zombie. */ + siginfo_t infop; + if (errno == EPERM && + waitid(P_PID, pid, &infop, WNOHANG | WNOWAIT | WEXITED) == 0) + return 0; +#endif return UV__ERR(errno); - else + } else return 0; }