From b75b4fadb7bfde912e4c3e654d5b5f77c53f07a4 Mon Sep 17 00:00:00 2001 From: Leaflet Date: Sat, 4 Apr 2026 19:49:51 +0800 Subject: [PATCH 1/5] Hide reply article (set visible = 0, TID = 0) whose topic article was purged --- src/section_list.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/section_list.c b/src/section_list.c index 2c74754..006e393 100644 --- a/src/section_list.c +++ b/src/section_list.c @@ -887,14 +887,23 @@ int section_list_append_article(SECTION_LIST *p_section, const ARTICLE *p_articl if (p_topic_head == NULL) { log_error("search head of topic (aid=%d) error", p_article->tid); - return -4; - } - p_topic_tail = p_topic_head->p_topic_prior; - if (p_topic_tail == NULL) + p_article->tid = 0; // Reset tid to 0 to avoid linking to non-existing topic + p_article->visible = 0; // Set invisible to avoid being displayed in topic list + + p_section->topic_count++; + + p_topic_head = p_article; + p_topic_tail = p_article; + } + else { - log_error("tail of topic (aid=%d) is NULL", p_article->tid); - return -4; + p_topic_tail = p_topic_head->p_topic_prior; + if (p_topic_tail == NULL) + { + log_error("tail of topic (aid=%d) is NULL", p_article->tid); + return -4; + } } } else From 041a35759586a1345ae832e34fa671f142c4bca7 Mon Sep 17 00:00:00 2001 From: Leaflet Date: Sat, 4 Apr 2026 19:54:52 +0800 Subject: [PATCH 2/5] Update service name in logrotate config file --- conf/lbbs.logrotate.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/lbbs.logrotate.in b/conf/lbbs.logrotate.in index 45930fe..bb7ccd4 100644 --- a/conf/lbbs.logrotate.in +++ b/conf/lbbs.logrotate.in @@ -7,6 +7,6 @@ create 640 bbs bbs sharedscripts postrotate - systemctl reload bbsd.service > /dev/null 2>/dev/null || true + systemctl reload lbbs.service > /dev/null 2>/dev/null || true endscript } From 436a6a452eaa9afb2cc109459f2c60b9bc699b1f Mon Sep 17 00:00:00 2001 From: Leaflet Date: Sat, 4 Apr 2026 19:56:25 +0800 Subject: [PATCH 3/5] Update version --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a947c5e..2aeba58 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([lbbs],[1.7.7]) +AC_INIT([lbbs],[1.7.8]) AC_CONFIG_SRCDIR([src/]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIRS([m4]) From 93da7426277b24242de1de9ffff6ab7b0d7b388d Mon Sep 17 00:00:00 2001 From: Leaflet Date: Sat, 4 Apr 2026 21:10:00 +0800 Subject: [PATCH 4/5] Unload menu to release allocated trie_dict_node while reloading menu --- src/net_server.c | 10 ++-------- src/section_list_loader.c | 5 +---- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/net_server.c b/src/net_server.c index 3173fbe..217f335 100644 --- a/src/net_server.c +++ b/src/net_server.c @@ -830,20 +830,14 @@ int net_server(const char *hostaddr, in_port_t port[]) BBS_eula_tm = file_stat.st_mtim.tv_sec; } - if (detach_menu_shm(&bbs_menu) < 0) - { - log_error("detach_menu_shm(bbs_menu) error"); - } + unload_menu(&bbs_menu); if (load_menu(&bbs_menu, CONF_MENU) < 0) { log_error("load_menu(bbs_menu) error"); unload_menu(&bbs_menu); } - if (detach_menu_shm(&top10_menu) < 0) - { - log_error("detach_menu_shm(top10_menu) error"); - } + unload_menu(&top10_menu); if (load_menu(&top10_menu, CONF_TOP10_MENU) < 0) { log_error("load_menu(top10_menu) error"); diff --git a/src/section_list_loader.c b/src/section_list_loader.c index 7566d55..734dd22 100644 --- a/src/section_list_loader.c +++ b/src/section_list_loader.c @@ -160,10 +160,7 @@ int load_section_config_from_db(int update_gen_ex) { snprintf(ex_menu_conf, sizeof(ex_menu_conf), "%s/%d", VAR_GEN_EX_MENU_DIR, p_section->sid); - if (detach_menu_shm(&(p_section->ex_menu_set)) < 0) - { - log_error("detach_menu_shm(%s) error", ex_menu_conf); - } + unload_menu(&(p_section->ex_menu_set)); if (load_menu(&(p_section->ex_menu_set), ex_menu_conf) < 0) { log_error("load_menu(%s) error", ex_menu_conf); From a774be0698e24514ea0aad130b78252626b8a1f8 Mon Sep 17 00:00:00 2001 From: Leaflet Date: Sat, 4 Apr 2026 21:14:58 +0800 Subject: [PATCH 5/5] Monitor trie_dict_node usage for debugging --- src/trie_dict.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/trie_dict.c b/src/trie_dict.c index b709261..4196ee8 100644 --- a/src/trie_dict.c +++ b/src/trie_dict.c @@ -162,20 +162,27 @@ TRIE_NODE *trie_dict_create(void) { TRIE_NODE *p_dict = NULL; - if (p_trie_node_pool != NULL && p_trie_node_pool->p_node_free_list != NULL) + if (p_trie_node_pool == NULL) { - p_dict = p_trie_node_pool->p_node_free_list; - p_trie_node_pool->p_node_free_list = p_dict->p_nodes[0]; + log_error("trie_dict_pool not initialized"); + return NULL; + } - memset(p_dict, 0, sizeof(*p_dict)); + log_debug("trie_dict_node used %d of %d", p_trie_node_pool->node_count, p_trie_node_pool->node_count_limit); - p_trie_node_pool->node_count++; - } - else if (p_trie_node_pool != NULL) + if (p_trie_node_pool->p_node_free_list == NULL) { log_error("trie_dict_create() error: node depleted %d >= %d", p_trie_node_pool->node_count, p_trie_node_pool->node_count_limit); + return NULL; } + p_dict = p_trie_node_pool->p_node_free_list; + p_trie_node_pool->p_node_free_list = p_dict->p_nodes[0]; + + memset(p_dict, 0, sizeof(*p_dict)); + + p_trie_node_pool->node_count++; + return p_dict; }