--- lbbs/src/init.c 2025/05/13 07:30:10 1.19 +++ lbbs/src/init.c 2025/06/01 03:07:42 1.21 @@ -34,9 +34,13 @@ int init_daemon(void) pid = fork(); - if (pid != 0) // Parent or error + if (pid > 0) // Parent process { - return pid; + _exit(0); + } + else if (pid < 0) // error + { + _exit(pid); } // Child process @@ -44,9 +48,13 @@ int init_daemon(void) pid = fork(); - if (pid != 0) // Parent or error + if (pid > 0) // Parent process + { + _exit(0); + } + else if (pid < 0) // error { - return pid; + _exit(pid); } // Child process @@ -100,6 +108,15 @@ int load_conf(const char *conf_file) if (strcmp(c_name, "bbs_max_client") == 0) { fscanf(fin, "%d", &BBS_max_client); + if (BBS_max_client > MAX_CLIENTS_LIMIT) + { + log_error("Config BBS_max_client > limit (%d), reset it to limit\n", BBS_max_client); + BBS_max_client = MAX_CLIENTS_LIMIT; + } + } + if (strcmp(c_name, "bbs_max_client_per_ip") == 0) + { + fscanf(fin, "%d", &BBS_max_client_per_ip); } if (strcmp(c_name, "bbs_max_user") == 0) {