--- lbbs/src/main.c 2025/06/25 01:50:14 1.59 +++ lbbs/src/main.c 2025/10/13 07:13:39 1.62 @@ -128,8 +128,16 @@ int main(int argc, char *argv[]) strncpy(file_path_temp, argv[0], sizeof(file_path_temp) - 1); file_path_temp[sizeof(file_path_temp) - 1] = '\0'; - chdir(dirname(file_path_temp)); - chdir(".."); + if (chdir(dirname(file_path_temp)) < 0) + { + fprintf(stderr, "chdir(%s) error: %d\n", dirname(file_path_temp), errno); + return -1; + } + if (chdir("..") < 0) + { + fprintf(stderr, "chdir(..) error: %d\n", errno); + return -1; + } // Initialize log if (log_begin(LOG_FILE_INFO, LOG_FILE_ERROR) < 0) @@ -207,8 +215,15 @@ int main(int argc, char *argv[]) // Load menus if (load_menu(&bbs_menu, CONF_MENU) < 0) { + log_error("load_menu(%s) error\n", CONF_MENU); + goto cleanup; + } + if (load_menu(&top10_menu, CONF_TOP10_MENU) < 0) + { + log_error("load_menu(%s) error\n", CONF_TOP10_MENU); goto cleanup; } + top10_menu.allow_exit = 1; // Load data files if (file_loader_init() < 0) @@ -224,10 +239,10 @@ int main(int argc, char *argv[]) } } - // Load section config - if (load_section_config_from_db(0) < 0) + // Load section config and gen_ex + if (load_section_config_from_db(1) < 0) { - log_error("load_section_config_from_db() error\n"); + log_error("load_section_config_from_db(0) error\n"); goto cleanup; } @@ -284,6 +299,7 @@ cleanup: // Cleanup menu unload_menu(&bbs_menu); + unload_menu(&top10_menu); // Cleanup data pools section_list_cleanup();