mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 23:42:34 +00:00
Ignore rc of child process when killed due to EOF
This commit is contained in:
parent
19ebd413bb
commit
a2086478e6
2 changed files with 10 additions and 2 deletions
3
CHANGES
3
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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue