Fix bug: Parent process exits but child process didn't

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
main^2
Jianhui Zhao 2021-01-04 15:48:09 +08:00
parent db85c135cb
commit 8c2e9c3a57
1 changed files with 3 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include <dlfcn.h>
#endif
#include <sys/sysinfo.h>
#include <sys/prctl.h>
#include "uhttpd_internal.h"
#include "connection.h"
@ -202,6 +203,8 @@ static void uh_start_worker(struct uh_server *srv, int n)
uh_log_err("fork: %s\n", strerror(errno));
return;
case 0:
prctl(PR_SET_PDEATHSIG, SIGKILL);
ev_loop_fork(srvi->loop);
if (srvi->reuseport) {