/[LeafOK_CVS]/lbbs/src/section_list_loader.c
ViewVC logotype

Diff of /lbbs/src/section_list_loader.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.57 by sysadm, Mon Nov 3 07:14:25 2025 UTC Revision 1.61 by sysadm, Tue Nov 4 01:49:26 2025 UTC
# Line 723  int section_list_loader_launch(void) Line 723  int section_list_loader_launch(void)
723          detach_menu_shm(&top10_menu);          detach_menu_shm(&top10_menu);
724    
725          // Set signal handler          // Set signal handler
726          act.sa_handler = SIG_DFL;          act.sa_handler = SIG_IGN;
727          if (sigaction(SIGHUP, &act, NULL) == -1)          if (sigaction(SIGHUP, &act, NULL) == -1)
728          {          {
729                  log_error("set signal action of SIGHUP error: %d\n", errno);                  log_error("set signal action of SIGHUP error: %d\n", errno);
# Line 892  int query_section_articles(SECTION_LIST Line 892  int query_section_articles(SECTION_LIST
892          }          }
893          else if (page_id < 0 || page_id >= *p_page_count)          else if (page_id < 0 || page_id >= *p_page_count)
894          {          {
895    #ifdef _DEBUG
896                  log_error("Invalid page_id=%d, not in range [0, %d)\n", page_id, *p_page_count);                  log_error("Invalid page_id=%d, not in range [0, %d)\n", page_id, *p_page_count);
897    #endif
898                  ret = -3;                  ret = -3;
899          }          }
900          else          else
# Line 931  int query_section_articles(SECTION_LIST Line 933  int query_section_articles(SECTION_LIST
933                                           : (page_id - p_section->page_count + 1) * BBS_article_limit_per_page - p_section->last_page_visible_article_count);                                           : (page_id - p_section->page_count + 1) * BBS_article_limit_per_page - p_section->last_page_visible_article_count);
934                          while (*p_article_count < BBS_article_limit_per_page && i < p_section->ontop_article_count)                          while (*p_article_count < BBS_article_limit_per_page && i < p_section->ontop_article_count)
935                          {                          {
936                                  p_articles[(*p_article_count)++] = p_section->p_ontop_articles[i++];                                  p_articles[*p_article_count] = p_section->p_ontop_articles[i++];
937                                    (*p_article_count)++;
938                          }                          }
939                  }                  }
940          }          }
# Line 1015  int locate_article_in_section(SECTION_LI Line 1018  int locate_article_in_section(SECTION_LI
1018                  p_article = section_list_find_article_with_offset(p_section, aid, &page_id, &offset, &p_tmp);                  p_article = section_list_find_article_with_offset(p_section, aid, &page_id, &offset, &p_tmp);
1019                  if (p_article != NULL)                  if (p_article != NULL)
1020                  {                  {
1021                          *p_article_count = (page_id == p_section->page_count - 1 ? p_section->last_page_visible_article_count : BBS_article_limit_per_page);                          *p_article_count = (page_id >= p_section->page_count - 1 ? p_section->last_page_visible_article_count : BBS_article_limit_per_page);
1022    
1023                          p_article = p_section->p_page_first_article[page_id];                          p_article = p_section->p_page_first_article[page_id];
1024                          for (i = 0; i < *p_article_count && p_article != NULL;)                          for (i = 0; i < *p_article_count && p_article != NULL;)
# Line 1036  int locate_article_in_section(SECTION_LI Line 1039  int locate_article_in_section(SECTION_LI
1039                                                  break;                                                  break;
1040                                          }                                          }
1041                                  }                                  }
1042    
1043                                  p_article = p_article->p_next;                                  p_article = p_article->p_next;
1044                                    if (p_article == p_section->p_page_first_article[page_id])
1045                                    {
1046                                            log_error("Dead loop detected at page=%d, article_count=%d\n", page_id, *p_article_count);
1047                                            break;
1048                                    }
1049                          }                          }
1050    
1051                          // Include ontop articles                          // Include ontop articles
# Line 1220  int scan_article_in_section_by_username( Line 1229  int scan_article_in_section_by_username(
1229  }  }
1230    
1231  int scan_article_in_section_by_title(SECTION_LIST *p_section, const ARTICLE *p_article_cur,  int scan_article_in_section_by_title(SECTION_LIST *p_section, const ARTICLE *p_article_cur,
1232                                                                                  int direction, const char *title, const ARTICLE **pp_article)                                                                           int direction, const char *title, const ARTICLE **pp_article)
1233  {  {
1234          ARTICLE *p_article;          ARTICLE *p_article;
1235          int ret = 0;          int ret = 0;


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1