--- lbbs/src/main.c 2025/11/04 14:58:56 1.70 +++ lbbs/src/main.c 2025/11/07 04:58:09 1.72 @@ -7,6 +7,7 @@ */ #include "bbs.h" +#include "bwf.h" #include "common.h" #include "file_loader.h" #include "init.h" @@ -155,6 +156,12 @@ int main(int argc, char *argv[]) return -2; } + // Load BWF config + if (bwf_load(CONF_BWF) < 0) + { + return -2; + } + // Check article cache dir ret = mkdir(VAR_ARTICLE_CACHE_DIR, 0750); if (ret == -1 && errno != EEXIST) @@ -202,9 +209,9 @@ int main(int argc, char *argv[]) printf("trie_dict_init(%s, %d) error\n", VAR_TRIE_DICT_SHM, TRIE_NODE_PER_POOL); goto cleanup; } - if (article_block_init(VAR_ARTICLE_BLOCK_SHM, BBS_article_limit_per_section * BBS_max_section / ARTICLE_PER_BLOCK) < 0) + if (article_block_init(VAR_ARTICLE_BLOCK_SHM, BBS_article_limit_per_section * BBS_max_section / BBS_article_count_per_block) < 0) { - log_error("article_block_init(%s, %d) error\n", VAR_ARTICLE_BLOCK_SHM, BBS_article_limit_per_section * BBS_max_section / ARTICLE_PER_BLOCK); + log_error("article_block_init(%s, %d) error\n", VAR_ARTICLE_BLOCK_SHM, BBS_article_limit_per_section * BBS_max_section / BBS_article_count_per_block); goto cleanup; } if (section_list_init(VAR_SECTION_LIST_SHM) < 0) @@ -337,6 +344,9 @@ cleanup: trie_dict_cleanup(); user_list_pool_cleanup(); + // Cleanup BWF + bwf_unload(); + if (unlink(VAR_ARTICLE_BLOCK_SHM) < 0) { log_error("unlink(%s) error\n", VAR_ARTICLE_BLOCK_SHM);