mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-20 19:41:58 +00:00
Not ignoring SIGCHLD, cause it renders system() unusable on QNX
This commit is contained in:
1 parent
73d2b395d1
commit
e28b3ca91d
1 file changed
+9
-6
+9
-6
@@ -77,7 +77,15 @@ static struct mg_context *ctx; // Set by start_mongoose()
|
|||||||
#endif /* !CONFIG_FILE */
|
#endif /* !CONFIG_FILE */
|
||||||
|
|
||||||
static void WINCDECL signal_handler(int sig_num) {
|
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, ...) {
|
static void die(const char *fmt, ...) {
|
||||||
@@ -375,11 +383,6 @@ static void start_mongoose(int argc, char *argv[]) {
|
|||||||
signal(SIGTERM, signal_handler);
|
signal(SIGTERM, signal_handler);
|
||||||
signal(SIGINT, 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
|
// Start Mongoose
|
||||||
memset(&callbacks, 0, sizeof(callbacks));
|
memset(&callbacks, 0, sizeof(callbacks));
|
||||||
callbacks.log_message = &log_message;
|
callbacks.log_message = &log_message;
|
||||||
|
|||||||
Reference in new issue
Block a user