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 <mmallick@ca.ibm.com>
Co-authored-by: Gaby Baghdadi <baghdadi@ca.ibm.com>
This commit is contained in:
Wayne Zhang 2022-05-25 09:12:57 -04:00 committed by GitHub
parent 99ab53e998
commit 51dcac5da7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}