mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-27 15:01:03 +08:00
Not ignoring SIGCHLD, cause it renders system() unusable on QNX
This commit is contained in:
parent
73d2b395d1
commit
e28b3ca91d
15
build/main.c
15
build/main.c
@ -77,7 +77,15 @@ static struct mg_context *ctx; // Set by start_mongoose()
|
||||
#endif /* !CONFIG_FILE */
|
||||
|
||||
static void WINCDECL signal_handler(int sig_num) {
|
||||
exit_flag = sig_num;
|
||||
#if !defined(_WIN32)
|
||||
// Do not do the trick with ignoring SIGCHLD, cause not all OSes (e.g. QNX)
|
||||
// reap zombies if SIGCHLD is ignored. On QNX, for example, waitpid()
|
||||
// fails if SIGCHLD is ignored, making system() non-functional.
|
||||
if (sig_num == SIGCHLD) {
|
||||
do {} while (waitpid(-1, &sig_num, WNOHANG) > 0);
|
||||
} else
|
||||
#endif
|
||||
{ exit_flag = sig_num; }
|
||||
}
|
||||
|
||||
static void die(const char *fmt, ...) {
|
||||
@ -375,11 +383,6 @@ static void start_mongoose(int argc, char *argv[]) {
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGINT, signal_handler);
|
||||
|
||||
#if !defined(_WIN32)
|
||||
// Also ignoring SIGCHLD to let the OS to reap zombies properly.
|
||||
(void) signal(SIGCHLD, SIG_IGN);
|
||||
#endif
|
||||
|
||||
// Start Mongoose
|
||||
memset(&callbacks, 0, sizeof(callbacks));
|
||||
callbacks.log_message = &log_message;
|
||||
|
Loading…
x
Reference in New Issue
Block a user