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

Diff of /lbbs/src/menu.c

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

Revision 1.53 by sysadm, Mon May 19 12:30:27 2025 UTC Revision 1.54 by sysadm, Tue May 20 12:18:24 2025 UTC
# Line 1331  int unload_menu(MENU_SET *p_menu_set) Line 1331  int unload_menu(MENU_SET *p_menu_set)
1331    
1332  int load_menu_shm(MENU_SET *p_menu_set)  int load_menu_shm(MENU_SET *p_menu_set)
1333  {  {
1334            void *p_shm;
1335    
1336          // Mount shared memory          // Mount shared memory
1337          if (p_menu_set->p_reserved == NULL)          p_shm = shmat(p_menu_set->shmid, NULL, SHM_RDONLY);
1338            if (p_shm == (void *)-1)
1339            {
1340                    log_error("shmat() error (%d)\n", errno);
1341                    return -1;
1342            }
1343    
1344            if (p_menu_set->p_reserved != NULL && shmdt(p_menu_set->p_reserved) == -1)
1345          {          {
1346                  p_menu_set->p_reserved = shmat(p_menu_set->shmid, NULL, SHM_RDONLY);                  log_error("shmdt() error (%d)\n", errno);
1347                  if (p_menu_set->p_reserved == (void *)-1)                  return -2;
                 {  
                         log_error("shmat() error (%d)\n", errno);  
                         return -1;  
                 }  
1348          }          }
1349            p_menu_set->p_reserved = p_shm;
1350    
1351          p_menu_set->p_menu_pool = p_menu_set->p_reserved + MENU_SET_RESERVED_LENGTH;          p_menu_set->p_menu_pool = p_menu_set->p_reserved + MENU_SET_RESERVED_LENGTH;
1352          p_menu_set->p_menu_item_pool = p_menu_set->p_menu_pool + sizeof(MENU) * MAX_MENUS;          p_menu_set->p_menu_item_pool = p_menu_set->p_menu_pool + sizeof(MENU) * MAX_MENUS;


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

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