Changeset 319
- Timestamp:
- Mar 15, 2011, 8:57:49 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_entropy.c
r252 r319 520 520 char arg1[80]; 521 521 522 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 523 struct passwd pwd; 524 char * buffer; 525 struct passwd * tempres; 526 #else 527 struct passwd * tempres; 528 #endif 529 522 530 SL_ENTER(_("sh_popen")); 531 532 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 533 buffer = SH_ALLOC(SH_PWBUF_SIZE); 534 sh_getpwnam_r(DEFAULT_IDENT, &pwd, buffer, SH_PWBUF_SIZE, &tempres); 535 #else 536 tempres = sh_getpwnam(DEFAULT_IDENT); 537 #endif 523 538 524 539 strncpy (arg0, _("/bin/sh"), sizeof(arg0)); … … 596 611 if (0 == geteuid()) 597 612 { 598 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R)599 struct passwd pwd;600 char * buffer = SH_ALLOC(SH_PWBUF_SIZE);601 struct passwd * tempres;602 sh_getpwnam_r(DEFAULT_IDENT, &pwd, buffer, SH_PWBUF_SIZE, &tempres);603 #else604 struct passwd * tempres = sh_getpwnam(DEFAULT_IDENT);605 #endif606 613 607 614 if (NULL != tempres) { … … 619 626 i = -1; 620 627 } 621 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R)622 SH_FREE(buffer);623 #endif624 628 } 625 629 … … 644 648 } 645 649 646 /* parent 647 */ 648 if (envp[0] != NULL) 649 free(envp[0]); 650 651 sl_close_fd (FIL__, __LINE__, pipedes[STDOUT_FILENO]); 652 retry_fcntl (FIL__, __LINE__, pipedes[STDIN_FILENO], F_SETFD, FD_CLOEXEC); 653 654 outf = fdopen (pipedes[STDIN_FILENO], "r"); 655 656 if (outf == NULL) 657 { 658 aud_kill (FIL__, __LINE__, source->pid, SIGKILL); 659 sl_close_fd (FIL__, __LINE__, pipedes[STDOUT_FILENO]); 660 waitpid (source->pid, NULL, 0); 661 source->pid = 0; 662 SL_RETURN(NULL, _("sh_popen")); 663 } 664 665 SL_RETURN(outf, _("sh_popen")); 650 /* parent 651 */ 652 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 653 SH_FREE(buffer); 654 #endif 655 656 if (envp[0] != NULL) 657 free(envp[0]); 658 659 sl_close_fd (FIL__, __LINE__, pipedes[STDOUT_FILENO]); 660 retry_fcntl (FIL__, __LINE__, pipedes[STDIN_FILENO], F_SETFD, FD_CLOEXEC); 661 662 outf = fdopen (pipedes[STDIN_FILENO], "r"); 663 664 if (outf == NULL) 665 { 666 aud_kill (FIL__, __LINE__, source->pid, SIGKILL); 667 sl_close_fd (FIL__, __LINE__, pipedes[STDOUT_FILENO]); 668 waitpid (source->pid, NULL, 0); 669 source->pid = 0; 670 SL_RETURN(NULL, _("sh_popen")); 671 } 672 673 SL_RETURN(outf, _("sh_popen")); 666 674 } 667 675
Note:
See TracChangeset
for help on using the changeset viewer.