Changeset 32 for trunk/src


Ignore:
Timestamp:
May 1, 2006, 9:56:54 PM (19 years ago)
Author:
rainer
Message:

Release version 2.2.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_entropy.c

    r30 r32  
    572572  char * envp[2];
    573573  size_t len;
     574  char   arg0[80];
     575  char   arg1[80];
    574576
    575577  SL_ENTER(_("sh_popen"));
    576578
    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;
    579583  arg[2] = command;
    580584  arg[3] = NULL;
     
    698702{
    699703    int status = 0;
     704    int retval;
     705    char msg[128];
    700706
    701707    SL_ENTER(_("sh_pclose"));
    702708
    703     status = fclose(source->pipe);
    704     if (status)
     709    retval = fclose(source->pipe);
     710    if (retval)
    705711      {
     712        sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, retval,
     713                         MSG_E_SUBGEN,
     714                         sh_error_message(retval),
     715                         _("sh_pclose"));
    706716        SL_RETURN((-1), _("sh_pclose"));
    707717      }
    708718
    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      }
    711739
    712740    source->pipe = NULL;
Note: See TracChangeset for help on using the changeset viewer.