--- lbbs/src/fork.c 2025/05/13 07:30:10 1.17 +++ lbbs/src/fork.c 2025/05/15 05:14:57 1.19 @@ -19,8 +19,10 @@ #include "log.h" #include "io.h" #include "fork.h" +#include "menu.h" #include #include +#include #include #include #include @@ -66,6 +68,13 @@ int fork_server() return -4; } + SYS_child_process_count = 0; + + // Reset signal handler to default + signal(SIGHUP, SIG_DFL); + signal(SIGCHLD, SIG_DFL); + signal(SIGTERM, SIG_DFL); + bbs_main(); // Child process exit @@ -80,9 +89,15 @@ int fork_server() close(STDIN_FILENO); close(STDOUT_FILENO); - log_std("Process exit normally\n"); + // Unload menu + unload_menu_shm(p_bbs_menu); + free(p_bbs_menu); + p_bbs_menu = NULL; + log_std("Process exit normally\n"); log_end(); + _exit(0); + return 0; }