- Timestamp:
- May 1, 2006, 9:56:54 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_entropy.c
r30 r32 572 572 char * envp[2]; 573 573 size_t len; 574 char arg0[80]; 575 char arg1[80]; 574 576 575 577 SL_ENTER(_("sh_popen")); 576 578 577 arg[0] = _("/bin/sh"); 578 arg[1] = _("-c"); 579 strncpy (arg0, _("/bin/sh"), sizeof(arg0)); 580 arg[0] = arg0; 581 strncpy (arg1, _("-c"), sizeof(arg1)); 582 arg[1] = arg1; 579 583 arg[2] = command; 580 584 arg[3] = NULL; … … 698 702 { 699 703 int status = 0; 704 int retval; 705 char msg[128]; 700 706 701 707 SL_ENTER(_("sh_pclose")); 702 708 703 status= fclose(source->pipe);704 if ( status)709 retval = fclose(source->pipe); 710 if (retval) 705 711 { 712 sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, retval, 713 MSG_E_SUBGEN, 714 sh_error_message(retval), 715 _("sh_pclose")); 706 716 SL_RETURN((-1), _("sh_pclose")); 707 717 } 708 718 709 if (waitpid(source->pid, NULL, 0) != source->pid) 710 status = -1; 719 retval = waitpid(source->pid, &status, 0); 720 if (retval != source->pid) 721 { 722 sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, retval, 723 MSG_E_SUBGEN, 724 sh_error_message(retval), 725 _("sh_pclose")); 726 727 status = -1; 728 } 729 else if (WIFSIGNALED(status)) 730 { 731 sl_snprintf(msg, sizeof(msg), _("Subprocess terminated by signal %d"), 732 WTERMSIG(status)); 733 sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, retval, 734 MSG_E_SUBGEN, 735 msg, 736 _("sh_pclose")); 737 status = -1; 738 } 711 739 712 740 source->pipe = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.