Ignore rc of child process when killed due to EOF

This commit is contained in:
Gerhard Rieger 2017-01-21 13:39:58 +01:00
parent 19ebd413bb
commit a2086478e6
2 changed files with 10 additions and 2 deletions

View file

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

View file

@ -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: