mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
BUG/MINOR: mworker: don't exit with an ambiguous value
When the sigchld handler is called and waitpid() returns -1, the behavior of waitpid() with the status variable is undefined. It is not a good idea to exit with the value contained in it. Since this exit path does not use the exitcode variable, it means that this is an expected and successful exit. This should be backported in 1.9, code has moved, mworker_catch_sigchld() is in haproxy.c.
This commit is contained in:
parent
32b6901550
commit
4cf4b33744
@ -295,11 +295,11 @@ restart_wait:
|
|||||||
}
|
}
|
||||||
/* Better rely on the system than on a list of process to check if it was the last one */
|
/* Better rely on the system than on a list of process to check if it was the last one */
|
||||||
else if (exitpid == -1 && errno == ECHILD) {
|
else if (exitpid == -1 && errno == ECHILD) {
|
||||||
ha_warning("All workers exited. Exiting... (%d)\n", (exitcode > 0) ? exitcode : status);
|
ha_warning("All workers exited. Exiting... (%d)\n", (exitcode > 0) ? exitcode : EXIT_SUCCESS);
|
||||||
atexit_flag = 0;
|
atexit_flag = 0;
|
||||||
if (exitcode > 0)
|
if (exitcode > 0)
|
||||||
exit(exitcode);
|
exit(exitcode); /* parent must leave using the status code that provoked the exit */
|
||||||
exit(status); /* parent must leave using the latest status code known */
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user