--- lbbs/src/init.c 2025/05/06 05:31:26 1.18 +++ lbbs/src/init.c 2025/06/01 03:07:42 1.21 @@ -28,7 +28,7 @@ #include #include -void init_daemon(void) +int init_daemon(void) { int pid; @@ -36,11 +36,11 @@ void init_daemon(void) if (pid > 0) // Parent process { - exit(0); + _exit(0); } - else if (pid < 0) // Error + else if (pid < 0) // error { - exit(1); + _exit(pid); } // Child process @@ -50,17 +50,17 @@ void init_daemon(void) if (pid > 0) // Parent process { - exit(0); + _exit(0); } - else if (pid < 0) // Error + else if (pid < 0) // error { - exit(1); + _exit(pid); } // Child process umask(022); - return; + return 0; } int load_conf(const char *conf_file) @@ -108,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) {