| 131 |
|
|
| 132 |
if ((!daemon) && std_log_redir) |
if ((!daemon) && std_log_redir) |
| 133 |
{ |
{ |
| 134 |
log_std_redirect(2); |
log_std_redirect(STDERR_FILENO); |
| 135 |
} |
} |
| 136 |
if ((!daemon) && error_log_redir) |
if ((!daemon) && error_log_redir) |
| 137 |
{ |
{ |
| 138 |
log_err_redirect(3); |
log_err_redirect(STDERR_FILENO); |
| 139 |
} |
} |
| 140 |
|
|
| 141 |
// Load configuration |
// Load configuration |
| 152 |
} |
} |
| 153 |
|
|
| 154 |
// Set signal handler |
// Set signal handler |
| 155 |
signal(SIGCHLD, child_exit); |
signal(SIGHUP, sig_hup_handler); |
| 156 |
signal(SIGTERM, system_exit); |
signal(SIGCHLD, sig_chld_handler); |
| 157 |
signal(SIG_RELOAD_MENU, reload_bbs_menu); |
signal(SIGTERM, sig_term_handler); |
| 158 |
|
|
| 159 |
// Initialize socket server |
// Initialize socket server |
| 160 |
net_server(BBS_address, BBS_port); |
net_server(BBS_address, BBS_port); |
| 161 |
|
|
|
// Wait for child process exit |
|
|
while (SYS_child_process_count > 0) |
|
|
{ |
|
|
log_std("Waiting for %d child process to exit\n", SYS_child_process_count); |
|
|
sleep(1); |
|
|
} |
|
|
|
|
| 162 |
// Cleanup |
// Cleanup |
| 163 |
unload_menu(&bbs_menu); |
unload_menu(&bbs_menu); |
| 164 |
|
|