Changeset 137 for trunk/src/samhain.c
- Timestamp:
- Oct 28, 2007, 1:17:58 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/samhain.c
r134 r137 139 139 140 140 #ifdef HAVE_PTHREAD 141 typedefstruct gt {141 struct gt { 142 142 size_t g_count; 143 143 char * g_glob; … … 149 149 { 150 150 struct gt * ptr = malloc(sizeof(struct gt)); 151 if (! gt)151 if (!ptr) 152 152 return -1; 153 153 ptr->g_count = 0; … … 166 166 } 167 167 168 staticvoid sh_g_init()168 void sh_g_init() 169 169 { 170 170 if (0 != pthread_key_create(&g_key, sh_g_destroy)) … … 176 176 if (0 != sh_g_thread()) 177 177 { 178 perror(" 1");178 perror("2"); 179 179 exit(EXIT_FAILURE); 180 180 } … … 191 191 size_t j; 192 192 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 198 194 static size_t count = 0; 199 195 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 { 203 205 return NULL; 206 } 207 #endif 208 209 if (str != NULL) 210 j = strlen(str); 204 211 else 205 j = strlen(str);212 return NULL; 206 213 207 214 ASSERT((j <= GLOB_LEN), _("j <= GLOB_LEN")) … … 228 235 i = count; 229 236 #ifdef HAVE_PTHREAD 230 ptr-> count = count + j + 1;237 ptr->g_count = count + j + 1; 231 238 #else 232 239 count = count + j + 1; … … 248 255 } 249 256 257 #else 258 /* not stealth */ 259 #define SH_G_INIT ((void)0) 250 260 #endif 251 261 … … 815 825 } 816 826 817 SH_MUTEX_LOCK( readdir_lock);827 SH_MUTEX_LOCK(mutex_readdir); 818 828 819 829 while (NULL != (d = readdir(dp)) && i < 65535) … … 838 848 } 839 849 840 SH_MUTEX_UNLOCK( readdir_lock);850 SH_MUTEX_UNLOCK(mutex_readdir); 841 851 842 852 closedir(dp);
Note:
See TracChangeset
for help on using the changeset viewer.