Changeset 4668 for zzuf


Ignore:
Timestamp:
Oct 5, 2010, 2:57:09 PM (9 years ago)
Author:
Sam Hocevar
Message:

Remove useless PARENT_FD/CHILD_FD hack.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/myfork.c

    r4667 r4668  
    7676
    7777#if defined HAVE_WINDOWS_H
    78 #   define PARENT_FD(x) ((x) ? 0 : 1)
    79 #   define CHILD_FD(x) ((x) ? 1 : 0)
    80 #else
    81 #   define PARENT_FD(x) 0
    82 #   define CHILD_FD(x) 1
    83 #endif
    84 
    85 #if defined HAVE_WINDOWS_H
    8678static void rep32(uint8_t *buf, void *addr);
    8779static int dll_inject(PROCESS_INFORMATION *, char const *);
     
    10698         * inherited. We then duplicate the part we want. */
    10799        ret = _pipe(pipes[i], 512, _O_BINARY | O_NOINHERIT);
    108         tmp = _dup(pipes[i][CHILD_FD(i)]);
    109         close(pipes[i][CHILD_FD(i)]);
    110         pipes[i][CHILD_FD(i)] = tmp;
     100        tmp = _dup(pipes[i][1]);
     101        close(pipes[i][1]);
     102        pipes[i][1] = tmp;
    111103#endif
    112104        if(ret < 0)
     
    128120    for(i = 0; i < 3; i++)
    129121    {
    130         close(pipes[i][CHILD_FD(i)]);
    131         child->fd[i] = pipes[i][PARENT_FD(i)];
     122        close(pipes[i][1]);
     123        child->fd[i] = pipes[i][0];
    132124    }
    133125
     
    280272    memset(&sinfo, 0, sizeof(sinfo));
    281273    sinfo.cb = sizeof(sinfo);
    282     sinfo.hStdInput = (HANDLE)_get_osfhandle(pipes[0][CHILD_FD(0)]);
    283     sinfo.hStdOutput = (HANDLE)_get_osfhandle(pipes[1][CHILD_FD(1)]);
    284     sinfo.hStdError = (HANDLE)_get_osfhandle(pipes[2][CHILD_FD(2)]);
     274    sinfo.hStdInput = INVALID_HANDLE_VALUE;
     275    sinfo.hStdOutput = (HANDLE)_get_osfhandle(pipes[2][1]);
     276    sinfo.hStdError = (HANDLE)_get_osfhandle(pipes[1][1]);
    285277    sinfo.dwFlags = STARTF_USESTDHANDLES;
    286278
Note: See TracChangeset for help on using the changeset viewer.