diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 32acafe..daed219 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -5,7 +5,10 @@ Short, specific pointers to help an AI coding agent be productive in this repo. **Build & Test** - **Install deps**: libssh, libpcre2 and a MySQL/MariaDB client dev package (e.g., libssh-dev, libpcre2-dev, libmariadb-dev or libmysqlclient-dev). CI also installs `libsystemd-dev`. - **Build**: `autoreconf --install --force` then `./configure --enable-systemd --disable-silent-rules` and `make`. -- **Run tests**: `make check` (tests are custom binaries built under `src/`, e.g. `test_trie_dict`). CI runs `make check` and `make distcheck` (see [.github/workflows/makefile.yml](.github/workflows/makefile.yml#L1-L40)). +- **Testers**: test programs are declared as `test_PROGRAMS` in [src/Makefile.am](src/Makefile.am#L1-L40), so `make` builds them but `make check` does not execute them (there is no `TESTS` variable) — CI only compiles them. Run them manually from `src/` (they resolve `../log` and `../data` relative to that directory): `cd src && ./test_trie_dict`. + - Non-interactive, database-free testers: `test_trie_dict`, `test_file_loader`, `test_lml`, `test_memory_pool`, `test_bbs`, `test_bwf`, `test_hash_dict`, `test_ip_mask`. (`test_hash_dict` is heavy: it allocates ~2.7 GB and takes tens of seconds.) + - Interactive and/or DB-dependent testers (need a configured MySQL/MariaDB and a terminal): `test_section_list`, `test_article_favor`, `test_article_view_log`, `test_ssh_server`. +- **CI**: runs `make`, `make check` and `make distcheck` (see [.github/workflows/makefile.yml](.github/workflows/makefile.yml#L1-L80)). **Run & Debug** - **Server binary**: `src/bbsd` (entry: [src/main.c](src/main.c#L1-L60)). diff --git a/src/article_favor.c b/src/article_favor.c index 11a00c1..fae15f6 100644 --- a/src/article_favor.c +++ b/src/article_favor.c @@ -60,11 +60,13 @@ int article_favor_load(int uid, ARTICLE_FAVOR *p_favor, int keep_inc) if (mysql_query(db, sql) != 0) { log_error("Query article_favorite error: %s", mysql_error(db)); + mysql_close(db); return -3; } if ((rs = mysql_use_result(db)) == NULL) { log_error("Get article_favorite data failed"); + mysql_close(db); return -3; } diff --git a/src/article_view_log.c b/src/article_view_log.c index 443e9c2..881490a 100644 --- a/src/article_view_log.c +++ b/src/article_view_log.c @@ -60,11 +60,13 @@ int article_view_log_load(int uid, ARTICLE_VIEW_LOG *p_view_log, int keep_inc) if (mysql_query(db, sql) != 0) { log_error("Query view_article_log error: %s", mysql_error(db)); + mysql_close(db); return -3; } if ((rs = mysql_store_result(db)) == NULL) { log_error("Get view_article_log data failed"); + mysql_close(db); return -3; } diff --git a/src/bbs_main.c b/src/bbs_main.c index 7850e59..6fd7d45 100644 --- a/src/bbs_main.c +++ b/src/bbs_main.c @@ -115,6 +115,7 @@ int bbs_logout(void) if (user_online_exp(db) < 0) { + mysql_close(db); return -2; } @@ -140,6 +141,7 @@ int bbs_session_cleanup(void) if (user_online_del(db) < 0) { + mysql_close(db); return -2; } diff --git a/src/bwf.c b/src/bwf.c index 8113e25..67e718a 100644 --- a/src/bwf.c +++ b/src/bwf.c @@ -59,6 +59,7 @@ int bwf_load(const char *filename) { log_error("Data line %d (len=%zu) is truncated", line_id, len_line); bwf_pattern_str[0] = '\0'; + fclose(fp); return -3; } @@ -82,6 +83,7 @@ int bwf_load(const char *filename) { log_error("Data in %s exceed length limit %zu", filename, sizeof(bwf_pattern_str) - 1); bwf_pattern_str[0] = '\0'; + fclose(fp); return -3; } @@ -143,6 +145,11 @@ int check_badwords(char *str, char c_mask) } match_data = pcre2_match_data_create_from_pattern(bwf_code, NULL); + if (match_data == NULL) + { + log_error("pcre2_match_data_create_from_pattern() error: OOM"); + return -1; + } while (1) { @@ -155,10 +162,13 @@ int check_badwords(char *str, char c_mask) else if (ret < 0) { log_error("pcre2_match() error: %d", ret); + break; } else if (ret == 0) { log_error("Vector of offsets is too small"); + ret = -2; + break; } else // ret >= 1 { @@ -171,6 +181,7 @@ int check_badwords(char *str, char c_mask) log_error("Bug: match pattern #%d of %d with invalid offsets [%zu, %zu)", i, match_count, ovector[i * 2], ovector[i * 2 + 1]); ret = -2; + break; } else { diff --git a/src/login.c b/src/login.c index 92c732d..8d428c1 100644 --- a/src/login.c +++ b/src/login.c @@ -395,7 +395,8 @@ int check_user(const char *username, const char *password) if (setenv("TZ", user_tz_env, 1) == -1) { log_error("setenv(TZ = %s) error %d", user_tz_env, errno); - return -3; + ret = -3; + goto cleanup; } tzset(); @@ -620,6 +621,7 @@ int user_online_update(const char *action) if (mysql_query(db, sql) != 0) { log_error("Update user_online error: %s", mysql_error(db)); + mysql_close(db); return -2; } diff --git a/src/menu.c b/src/menu.c index cffad15..75d849c 100644 --- a/src/menu.c +++ b/src/menu.c @@ -53,8 +53,9 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) int fd; size_t size; void *p_shm; - FILE *fin; + FILE *fin = NULL; int fin_line = 0; + int ret = 0; char buffer[LINE_BUFFER_LEN]; char temp[LINE_BUFFER_LEN]; char *p = NULL; @@ -113,19 +114,22 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (shm_unlink(p_menu_set->shm_name) == -1 && errno != ENOENT) { log_error("shm_unlink(%s) error (%d)", p_menu_set->shm_name, errno); - return -2; + ret = -2; + goto cleanup; } if ((fd = shm_open(p_menu_set->shm_name, O_CREAT | O_EXCL | O_RDWR, 0600)) == -1) { log_error("shm_open(%s) error (%d)", p_menu_set->shm_name, errno); - return -2; + ret = -2; + goto cleanup; } if (ftruncate(fd, (off_t)size) == -1) { log_error("ftruncate(size=%zu) error (%d)", size, errno); close(fd); - return -2; + ret = -2; + goto cleanup; } p_shm = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0L); @@ -133,13 +137,15 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) { log_error("mmap() error (%d)", errno); close(fd); - return -2; + ret = -2; + goto cleanup; } if (close(fd) < 0) { log_error("close(fd) error (%d)", errno); - return -1; + ret = -1; + goto cleanup; } p_menu_set->shm_size = size; @@ -183,13 +189,15 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (p_menu != NULL) { log_error("Incomplete menu definition in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } if (p_menu_set->menu_count >= MAX_MENUS) { log_error("Menu count (%d) exceed limit (%d)", p_menu_set->menu_count, MAX_MENUS); - return -3; + ret = -3; + goto cleanup; } menu_id = (MENU_ID)p_menu_set->menu_count; p_menu_set->menu_count++; @@ -207,7 +215,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu name in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isalnum((int)*q) || *q == '_' || *q == '-') @@ -217,13 +226,15 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu name in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } if (q - p > sizeof(p_menu->name) - 1) { log_error("Too longer menu name in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } strncpy(p_menu->name, p, sizeof(p_menu->name) - 1); p_menu->name[sizeof(p_menu->name) - 1] = '\0'; @@ -238,7 +249,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q != NULL) { log_error("Unknown extra content in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } while (fgets(buffer, sizeof(buffer), fin)) @@ -267,12 +279,14 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (p_menu->item_count >= MAX_ITEMS_PER_MENU) { log_error("Menuitem count per menu (%d) exceed limit (%d)", p_menu->item_count, MAX_ITEMS_PER_MENU); - return -1; + ret = -1; + goto cleanup; } if (p_menu_set->menu_item_count >= MAX_MENUITEMS) { log_error("Menuitem count (%d) exceed limit (%d)", p_menu_set->menu_item_count, MAX_MENUITEMS); - return -3; + ret = -3; + goto cleanup; } menu_item_id = (MENU_ITEM_ID)p_menu_set->menu_item_count; p_menu_set->menu_item_count++; @@ -300,14 +314,16 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu item action in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } } if (q - p > sizeof(p_menu_item->action) - 1) { log_error("Too longer menu action in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } strncpy(p_menu_item->action, p, sizeof(p_menu_item->action) - 1); p_menu_item->action[sizeof(p_menu_item->action) - 1] = '\0'; @@ -317,7 +333,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu item row in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isdigit((int)*q)) @@ -327,7 +344,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu item row in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_menu_item->row = (int16_t)atoi(p); @@ -336,7 +354,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu item col in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isdigit((int)*q)) @@ -346,7 +365,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu item col in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_menu_item->col = (int16_t)atoi(p); @@ -355,7 +375,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu item priv in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isdigit((int)*q)) @@ -365,7 +386,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu item priv in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_menu_item->priv = atoi(p); @@ -374,7 +396,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu item level in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isdigit((int)*q)) @@ -384,7 +407,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu item level in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_menu_item->level = atoi(p); @@ -393,7 +417,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL || *q != '\"') { log_error("Error menu item name in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } q++; p = q; @@ -413,14 +438,16 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\"' || *(q + 1) != '\0') { log_error("Error menu item name in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } *q = '\0'; if (q - p > sizeof(p_menu_item->name) - 1) { log_error("Too longer menu name in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } strncpy(p_menu_item->name, p, sizeof(p_menu_item->name) - 1); p_menu_item->name[sizeof(p_menu_item->name) - 1] = '\0'; @@ -430,7 +457,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL || (q = strchr(q, '\"')) == NULL) { log_error("Error menu item text in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } q++; p = q; @@ -450,14 +478,16 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\"') { log_error("Error menu item text in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } *q = '\0'; if (q - p > sizeof(p_menu_item->text) - 1) { log_error("Too longer menu item text in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } strncpy(p_menu_item->text, p, sizeof(p_menu_item->text) - 1); p_menu_item->text[sizeof(p_menu_item->text) - 1] = '\0'; @@ -467,7 +497,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q != NULL) { log_error("Unknown extra content in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } } else if (strcmp(p, "title") == 0) @@ -479,7 +510,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu title row in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isdigit((int)*q)) @@ -489,7 +521,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu title row in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_menu->title.row = (int16_t)atoi(p); @@ -498,7 +531,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu title col in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isdigit((int)*q)) @@ -508,7 +542,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu title col in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_menu->title.col = (int16_t)atoi(p); @@ -517,7 +552,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL || (q = strchr(q, '\"')) == NULL) { log_error("Error menu title text in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } q++; p = q; @@ -537,14 +573,16 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\"') { log_error("Error menu title text in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } *q = '\0'; if (q - p > sizeof(p_menu->title.text) - 1) { log_error("Too longer menu title text in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } strncpy(p_menu->title.text, p, sizeof(p_menu->title.text) - 1); p_menu->title.text[sizeof(p_menu->title.text) - 1] = '\0'; @@ -554,7 +592,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q != NULL) { log_error("Unknown extra content in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } } else if (strcmp(p, "screen") == 0) @@ -566,7 +605,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu screen row in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isdigit((int)*q)) @@ -576,7 +616,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu screen row in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_menu->screen_row = (int16_t)atoi(p); @@ -585,7 +626,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu screen col in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isdigit((int)*q)) @@ -595,7 +637,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu screen col in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_menu->screen_col = (int16_t)atoi(p); @@ -604,7 +647,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu screen name in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isalnum((int)*q) || *q == '_' || *q == '-') @@ -614,7 +658,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu screen name in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } strncpy(p_menu->screen_name, p, sizeof(p_menu->screen_name) - 1); p_menu->screen_name[sizeof(p_menu->screen_name) - 1] = '\0'; @@ -624,7 +669,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q != NULL) { log_error("Unknown extra content in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } } else if (strcmp(p, "page") == 0) @@ -634,7 +680,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu page row in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isdigit((int)*q)) @@ -644,7 +691,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu page row in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_menu->page_row = (int16_t)atoi(p); @@ -653,7 +701,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu page col in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isdigit((int)*q)) @@ -663,7 +712,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu page col in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_menu->page_col = (int16_t)atoi(p); @@ -672,7 +722,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q == NULL) { log_error("Error menu page item limit in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p = q; while (isdigit((int)*q)) @@ -682,7 +733,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu page item limit in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_menu->page_item_limit = (int16_t)atoi(p); @@ -691,7 +743,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q != NULL) { log_error("Unknown extra content in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } } else if (strcmp(p, "use_filter") == 0) @@ -703,7 +756,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q != NULL) { log_error("Unknown extra content in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } } } @@ -713,7 +767,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (p_menu_set->menu_item_count >= MAX_MENUS) { log_error("Menu screen count (%d) exceed limit (%d)", p_menu_set->menu_screen_count, MAX_MENUS); - return -3; + ret = -3; + goto cleanup; } screen_id = (MENU_SCREEN_ID)p_menu_set->menu_screen_count; p_menu_set->menu_screen_count++; @@ -728,7 +783,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (*q != '\0') { log_error("Error menu screen name in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } strncpy(p_screen->name, p, sizeof(p_screen->name) - 1); p_screen->name[sizeof(p_screen->name) - 1] = '\0'; @@ -743,7 +799,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (q != NULL) { log_error("Unknown extra content in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } p_screen->buf_offset = p_menu_set->p_menu_screen_buf_free - p_menu_set->p_menu_screen_buf; @@ -764,7 +821,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (p_menu_set->p_menu_screen_buf_free + 1 > q) { log_error("Menu screen buffer depleted (%p + 1 > %p)", p_menu_set->p_menu_screen_buf_free, q); - return -3; + ret = -3; + goto cleanup; } *(p_menu_set->p_menu_screen_buf_free) = '\0'; @@ -777,7 +835,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (p_menu_set->p_menu_screen_buf_free + strlen(CTRL_SEQ_CLR_LINE) > q) { log_error("Menu screen buffer depleted (%p + %zu > %p)", p_menu_set->p_menu_screen_buf_free, strlen(CTRL_SEQ_CLR_LINE), q); - return -3; + ret = -3; + goto cleanup; } p_menu_set->p_menu_screen_buf_free = stpcpy(p_menu_set->p_menu_screen_buf_free, CTRL_SEQ_CLR_LINE); @@ -787,7 +846,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) if (p_menu_set->p_menu_screen_buf_free + 2 > q) { log_error("Menu screen buffer depleted (%p + 2 > %p)", p_menu_set->p_menu_screen_buf_free, q); - return -3; + ret = -3; + goto cleanup; } if (*p == '\n' && p > buffer && *(p - 1) != '\r') @@ -811,10 +871,12 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) else // Invalid prefix { log_error("Error in menu config line %d", fin_line); - return -1; + ret = -1; + goto cleanup; } } fclose(fin); + fin = NULL; for (menu_id = 0; menu_id < p_menu_set->menu_count; menu_id++) { @@ -868,6 +930,14 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file) *(((int16_t *)p_menu_set->p_reserved) + 2) = p_menu_set->menu_screen_count; return 0; + +cleanup: + if (fin != NULL) + { + fclose(fin); + } + + return ret; } int display_menu_cursor(MENU_SET *p_menu_set, int show) diff --git a/src/menu_proc.c b/src/menu_proc.c index 8b3b0db..f2a1dc6 100644 --- a/src/menu_proc.c +++ b/src/menu_proc.c @@ -220,9 +220,6 @@ int view_ex_article(void *param) ARTICLE_CACHE cache; ARTICLE *p_article; int32_t aid = atoi(param); - int ret; - - (void)ret; p_article = article_block_find_by_aid(aid); if (p_article == NULL) @@ -242,8 +239,8 @@ int view_ex_article(void *param) log_error("user_online_update(VIEW_ARTICLE) error"); } - ret = display_data(cache.p_data, cache.line_total, cache.line_offsets, 0, - display_ex_article_key_handler, DATA_READ_HELP); + display_data(cache.p_data, cache.line_total, cache.line_offsets, 0, + display_ex_article_key_handler, DATA_READ_HELP); if (article_cache_unload(&cache) < 0) {