1
0
mirror of https://github.com/fumiama/simple-http-server.git synced 2026-06-05 00:30:23 +08:00

修复作为daemon失败

This commit is contained in:
源文雨
2021-06-07 22:15:23 +08:00
parent c85e9c51e0
commit cd44d1bd68

View File

@@ -541,6 +541,8 @@ int main(int argc, char **argv) {
printf("httpd running on port %d\n", port);
if(as_daemon) {
pid = fork();
if(pid == 0) pid = fork();
else return 0;
while (pid > 0) { //主进程监控子进程状态,如果子进程异常终止则重启之
wait(NULL);
puts("Server subprocess exited. Restart...");