Changeset 137 for trunk/src/samhain.c


Ignore:
Timestamp:
Oct 28, 2007, 1:17:58 AM (17 years ago)
Author:
rainer
Message:

Fix compile errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/samhain.c

    r134 r137  
    139139
    140140#ifdef HAVE_PTHREAD
    141 typedef struct gt {
     141struct gt {
    142142  size_t g_count;
    143143  char * g_glob;
     
    149149{
    150150  struct gt * ptr = malloc(sizeof(struct gt));
    151   if (!gt)
     151  if (!ptr)
    152152    return -1;
    153153  ptr->g_count    = 0;
     
    166166}
    167167
    168 static void sh_g_init()
     168void sh_g_init()
    169169{
    170170  if (0 != pthread_key_create(&g_key, sh_g_destroy))
     
    176176  if (0 != sh_g_thread())
    177177    {
    178       perror("1");
     178      perror("2");
    179179      exit(EXIT_FAILURE);
    180180    }
     
    191191  size_t j;
    192192
    193 #ifdef HAVE_PTHREAD
    194   struct gt * ptr = pthread_getspecific(g_key);
    195   size_t count = ptr->g_count;
    196   char *  glob = ptr->g_glob;
    197 #else
     193#ifndef HAVE_PTHREAD
    198194  static   size_t  count = 0;
    199195  static   char glob[SH_MAX_GLOBS * (GLOB_LEN+1)];
    200 #
    201 
    202   if (str == NULL)
     196#else
     197  struct gt * ptr = pthread_getspecific(g_key);
     198  size_t count;
     199  char *  glob;
     200
     201  if (ptr) {
     202    count = ptr->g_count;
     203    glob  = ptr->g_glob;
     204  } else {
    203205    return NULL;
     206  }
     207#endif
     208
     209  if (str != NULL)
     210    j = strlen(str);
    204211  else
    205     j = strlen(str);
     212    return NULL;
    206213
    207214  ASSERT((j <= GLOB_LEN), _("j <= GLOB_LEN"))
     
    228235  i     = count;
    229236#ifdef HAVE_PTHREAD
    230   ptr->count = count + j + 1;
     237  ptr->g_count = count + j + 1;
    231238#else
    232239  count = count + j + 1;
     
    248255}
    249256
     257#else
     258/* not stealth */
     259#define SH_G_INIT ((void)0)
    250260#endif
    251261
     
    815825    }
    816826
    817   SH_MUTEX_LOCK(readdir_lock);
     827  SH_MUTEX_LOCK(mutex_readdir);
    818828
    819829  while (NULL != (d = readdir(dp)) && i < 65535)
     
    838848    }
    839849
    840   SH_MUTEX_UNLOCK(readdir_lock);
     850  SH_MUTEX_UNLOCK(mutex_readdir);
    841851
    842852  closedir(dp);
Note: See TracChangeset for help on using the changeset viewer.