/[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.34 by sysadm, Tue Jun 24 10:01:24 2025 UTC Revision 1.37 by sysadm, Wed Jun 25 02:49:20 2025 UTC
# Line 134  int load_section_config_from_db(int relo Line 134  int load_section_config_from_db(int relo
134                                  break;                                  break;
135                          }                          }
136    
137                          strncpy(p_section->sname, row[0], sizeof(p_section->sname) - 1);                          strncpy(p_section->sname, row[1], sizeof(p_section->sname) - 1);
138                          p_section->sname[sizeof(p_section->sname) - 1] = '\0';                          p_section->sname[sizeof(p_section->sname) - 1] = '\0';
139                          strncpy(p_section->stitle, row[1], sizeof(p_section->stitle) - 1);                          strncpy(p_section->stitle, row[2], sizeof(p_section->stitle) - 1);
140                          p_section->stitle[sizeof(p_section->stitle) - 1] = '\0';                          p_section->stitle[sizeof(p_section->stitle) - 1] = '\0';
141                          strncpy(p_section->master_list, master_list, sizeof(p_section->master_list) - 1);                          strncpy(p_section->master_list, master_list, sizeof(p_section->master_list) - 1);
142                          p_section->master_list[sizeof(p_section->master_list) - 1] = '\0';                          p_section->master_list[sizeof(p_section->master_list) - 1] = '\0';
# Line 152  int load_section_config_from_db(int relo Line 152  int load_section_config_from_db(int relo
152                  {                  {
153                          snprintf(ex_menu_conf, sizeof(ex_menu_conf), "%s/%d", VAR_GEN_EX_MENU_DIR, p_section->sid);                          snprintf(ex_menu_conf, sizeof(ex_menu_conf), "%s/%d", VAR_GEN_EX_MENU_DIR, p_section->sid);
154    
155                          ret = load_menu(&ex_menu_set_new, ex_menu_conf);                          // acquire rw lock of all sections to avoid conflict with menu reload in main process
156                            ret = section_list_rw_lock(NULL);
157                          if (ret < 0)                          if (ret < 0)
158                          {                          {
159                                  log_error("load_menu(%s) error: %d\n", ex_menu_conf, ret);                                  log_error("section_list_rw_lock(NULL) error\n");
                                 unload_menu(&ex_menu_set_new);  
160                          }                          }
161                          else                          else
162                          {                          {
163                                  if (p_section->ex_menu_tm > 0)                                  ret = load_menu(&ex_menu_set_new, ex_menu_conf);
164                                    if (ret < 0)
165                                  {                                  {
166                                          unload_menu(&(p_section->ex_menu_set));                                          unload_menu(&ex_menu_set_new);
167                                            log_error("load_menu(%s) error: %d\n", ex_menu_conf, ret);
168                                  }                                  }
169                                    else
170                                    {
171                                            if (p_section->ex_menu_tm > 0)
172                                            {
173                                                    unload_menu(&(p_section->ex_menu_set));
174                                            }
175    
176                                  ex_menu_set_new.allow_exit = 1; // Allow exit menu                                          ex_menu_set_new.allow_exit = 1; // Allow exit menu
177                                  memcpy(&(p_section->ex_menu_set), &ex_menu_set_new, sizeof(ex_menu_set_new));                                          memcpy(&(p_section->ex_menu_set), &ex_menu_set_new, sizeof(ex_menu_set_new));
                                 set_menu_shm_readonly(&(p_section->ex_menu_set));  
178    
179                                  p_section->ex_menu_tm = atol(row[7]);                                          p_section->ex_menu_tm = atol(row[7]);
180  #ifdef _DEBUG  #ifdef _DEBUG
181                                  log_common("Loaded gen_ex_menu of section %d [%s]\n", p_section->sid, p_section->sname);                                          log_common("Loaded gen_ex_menu of section %d [%s]\n", p_section->sid, p_section->sname);
182  #endif  #endif
183                                    }
184    
185                                    // release rw lock of all sections
186                                    ret = section_list_rw_unlock(NULL);
187                                    if (ret < 0)
188                                    {
189                                            log_error("section_list_rw_unlock(NULL) error\n");
190                                    }
191                          }                          }
192                  }                  }
193    
# Line 701  int section_list_loader_launch(void) Line 716  int section_list_loader_launch(void)
716          SYS_child_process_count = 0;          SYS_child_process_count = 0;
717    
718          // Detach menu in shared memory          // Detach menu in shared memory
719          detach_menu_shm(p_bbs_menu);          detach_menu_shm(&bbs_menu);
         free(p_bbs_menu);  
         p_bbs_menu = NULL;  
720    
721          // Set signal handler          // Set signal handler
722          act.sa_handler = SIG_DFL;          act.sa_handler = SIG_DFL;
# Line 800  int section_list_loader_launch(void) Line 813  int section_list_loader_launch(void)
813    
814          // gen_ex_menu cleanup          // gen_ex_menu cleanup
815          section_list_ex_menu_set_cleanup();          section_list_ex_menu_set_cleanup();
816            
817          // Detach data pools shm          // Detach data pools shm
818          detach_section_list_shm();          detach_section_list_shm();
819          detach_article_block_shm();          detach_article_block_shm();


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

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