diff --git a/CHANGES b/CHANGES index 94a280e..af1a1ee 100644 --- a/CHANGES +++ b/CHANGES @@ -57,6 +57,9 @@ corrections: The internal vsnprintf_r function looped or crashed on size parameter with hexadecimal output. + Ignore exit code of child process when it was killed by master due to + EOF + porting: Type conflict between int and sig_atomic_t between declaration and definition of diag_immediate_type and diag_immediate_exit broke diff --git a/xioclose.c b/xioclose.c index b7e168e..d2922f1 100644 --- a/xioclose.c +++ b/xioclose.c @@ -54,9 +54,14 @@ int xioclose1(struct single *pipe) { switch (pipe->howtoend) { case END_KILL: case END_SHUTDOWN_KILL: case END_CLOSE_KILL: if (pipe->para.exec.pid > 0) { - if (Kill(pipe->para.exec.pid, SIGTERM) < 0) { + pid_t pid; + + /* first unregister child pid, so our sigchld handler will not throw an error */ + pid = pipe->para.exec.pid; + pipe->para.exec.pid = 0; + if (Kill(pid, SIGTERM) < 0) { Msg2(errno==ESRCH?E_INFO:E_WARN, "kill(%d, SIGTERM): %s", - pipe->para.exec.pid, strerror(errno)); + pid, strerror(errno)); } } default: