- Timestamp:
- Aug 27, 2008, 5:40:28 PM (16 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dnmalloc.c
r173 r174 1508 1508 pthread_mutex_unlock(&mALLOC_MUTEx); 1509 1509 } 1510 void dnmalloc_fork_child(void) { 1510 void dnmalloc_fork_child(void) { 1511 int rc; 1511 1512 #ifdef __GLIBC__ 1512 1513 if (dnmalloc_use_mutex) 1513 pthread_mutex_init(&mALLOC_MUTEx, NULL); 1514 { 1515 pthread_mutex_unlock (&mALLOC_MUTEx); 1516 pthread_mutex_destroy(&mALLOC_MUTEx); 1517 rc = pthread_mutex_init(&mALLOC_MUTEx, NULL); 1518 } 1514 1519 #else 1515 1520 if (dnmalloc_use_mutex) 1516 pthread_mutex_unlock(&mALLOC_MUTEx); 1517 #endif 1521 rc = pthread_mutex_unlock(&mALLOC_MUTEx); 1522 #endif 1523 if (rc != 0) 1524 { 1525 fputs("fork_child failed", stderr); 1526 _exit(EXIT_FAILURE); 1527 } 1518 1528 } 1519 1529 static int dnmalloc_mutex_lock(pthread_mutex_t *mutex) -
trunk/src/samhain.c
r172 r174 1234 1234 /* --- Close all but first three file descriptors. --- 1235 1235 */ 1236 sh_unix_closeall(3, -1 ); /* at program start */1236 sh_unix_closeall(3, -1, SL_FALSE); /* at program start */ 1237 1237 1238 1238 -
trunk/src/sh_entropy.c
r171 r174 581 581 /* don't leak file descriptors 582 582 */ 583 sh_unix_closeall (3, -1 ); /* in child process */583 sh_unix_closeall (3, -1, SL_TRUE); /* in child process */ 584 584 585 585 /* zero priv info -
trunk/src/sh_extern.c
r170 r174 294 294 */ 295 295 #if !defined(PDGBFILE) 296 sh_unix_closeall (3, task->com_fd ); /* in child process */296 sh_unix_closeall (3, task->com_fd, SL_TRUE); /* in child process */ 297 297 #endif 298 298 -
trunk/src/sh_gpg.c
r170 r174 487 487 /* don't leak file descriptors 488 488 */ 489 sh_unix_closeall (3, -1 ); /* in child process */489 sh_unix_closeall (3, -1, SL_TRUE); /* in child process */ 490 490 491 491 if (NULL == freopen(_("/dev/null"), "r+", stderr)) -
trunk/src/sh_unix.c
r172 r174 1246 1246 #endif 1247 1247 1248 void sh_unix_closeall (int fd, int except )1248 void sh_unix_closeall (int fd, int except, int inchild) 1249 1249 { 1250 1250 int fdx = fd; … … 1281 1281 } 1282 1282 1283 sl_dropall (fdx, except); 1283 if (!inchild) 1284 sl_dropall (fdx, except); 1285 else 1286 sl_dropall_dirty (fdx, except); 1284 1287 1285 1288 SL_RET0(_("sh_unix_closeall")); -
trunk/src/slib.c
r170 r174 2093 2093 (void) free(ofiles[fd]->path); 2094 2094 (void) free(ofiles[fd]); 2095 ofiles[fd] = NULL; 2096 } 2097 ++fd; 2098 } 2099 return 0; 2100 } 2101 2102 int sl_dropall_dirty(int fd, int except) 2103 { 2104 while (fd < MAXFD) 2105 { 2106 if (ofiles[fd] != NULL && fd != except) 2107 { 2095 2108 ofiles[fd] = NULL; 2096 2109 }
Note:
See TracChangeset
for help on using the changeset viewer.