Changeset 1009


Ignore:
Timestamp:
Feb 21, 2017, 1:50:18 AM (8 years ago)
Author:
dmik
Message:

rpm: Revert r634, r635, r639.

This is no longer necessary as fork crash was fixed in NSPR.
See #143 for more details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rpm/trunk/cliutils.c

    r639 r1009  
    1515
    1616static pid_t pipeChild = 0;
    17 #ifdef __KLIBC__
    18 static FILE* pipeFD = NULL;
    19 #endif
    2017
    2118RPM_GNUC_NORETURN
     
    5350    int p[2];
    5451
    55 #ifdef __KLIBC__
    56 
    57     char cmdline[16*1024];
    58     // place command line inside quotes to allow sh to execute all commands
    59     // itself (otherwise also cmd is involved)
    60     sprintf( cmdline, "sh -c \"%s\"", rpmcliPipeOutput);
    61     // start child and redirect its input to us
    62     pipeFD = popen( cmdline, "w");
    63     if (pipeFD == NULL) {
    64         fprintf(stderr, "creating a pipe for --pipe failed: %s\n", cmdline);
    65         return -1;
    66     }
    67     // now redirect stdout to input handle
    68     dup2( fileno(pipeFD), STDOUT_FILENO);
    69 
    70 #else
    71 
    7252    if (pipe(p) < 0) {
    7353        fprintf(stderr, _("creating a pipe for --pipe failed: %m\n"));
     
    8868    (void) dup2(p[1], STDOUT_FILENO);
    8969    (void) close(p[1]);
    90 #endif
    91 
    9270    return 0;
    9371}
     
    9674{
    9775    int rc = 0;
    98 
    99 #ifdef __KLIBC__
    100 
    101   if (pipeFD) {
    102     // close stdout to allow child to end
    103     (void) fclose(stdout);
    104     // wait child end and query exit code
    105     int status = pclose(pipeFD);
    106     pipeFD = NULL;
    107     if (!WIFEXITED(status) || WEXITSTATUS(status))
    108         rc = 1;
    109   }
    110 
    111 #else
    11276    if (pipeChild) {
    11377        int status;
     
    12286            rc = 1;
    12387    }
    124 #endif
    125 
    12688    return rc;
    12789}
Note: See TracChangeset for help on using the changeset viewer.