Changeset 149 for trunk/src/samhain.c


Ignore:
Timestamp:
Jan 7, 2008, 8:52:13 PM (17 years ago)
Author:
katerina
Message:

Make sh_hash.c thread-safe, remove plenty of tiny allocations, improve sh_mem_dump, modify port check to run as thread, and fix unsetting of sh_thread_pause_flag (was too early).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/samhain.c

    r145 r149  
    818818  if (0 != stat(SH_INSTALL_PATH, &buf))
    819819    {
    820       dummy = pidlist;
     820      dummy = (pid_t *)pidlist;
    821821      free(dummy);
    822822      return NULL;
     
    827827  if (NULL == (dp = opendir("/proc")))
    828828    {
    829       dummy = pidlist;
     829      dummy = (pid_t *)pidlist;
    830830      free(dummy);
    831831      return NULL;
     
    858858
    859859  closedir(dp);
    860   return pidlist;
     860  return (pid_t *)pidlist;
    861861}
    862862#else
     
    17551755              for (modnum = 0; modList[modnum].name != NULL; ++modnum)
    17561756                {
    1757                   if (modList[modnum].initval >= SH_MOD_ACTIVE)
    1758                     (void) modList[modnum].mod_reconf();
     1757                  /* sh_thread_pause_flag is true, and we block in lock
     1758                   * until check has returned, so we are sure check will
     1759                   * not run until sh_thread_pause_flag is set to false
     1760                   */
     1761                  /* if (modList[modnum].initval >= SH_MOD_ACTIVE) */
     1762                  (void) modList[modnum].mod_reconf();
    17591763                }
    17601764#endif
     
    18011805                }
    18021806
    1803               sh_thread_pause_flag = S_FALSE;
    18041807
    18051808              /* --- Initialize modules. ---
     
    18321835                    }
    18331836                }
     1837
     1838              /* module is properly set up now
     1839               */
     1840              sh_thread_pause_flag = S_FALSE;
    18341841             
    18351842              --sig_raised;
     
    20692076        sh_hash_writeout ();
    20702077
     2078      /* no-op unless MEM_LOG is defined in sh_mem.c
     2079       */
     2080#ifdef MEM_DEBUG
     2081      sh_mem_dump ();
     2082#endif
     2083
    20712084      /* no loop if not daemon
    20722085       */
Note: See TracChangeset for help on using the changeset viewer.