Ignore:
Timestamp:
Oct 7, 2007, 2:24:15 AM (18 years ago)
Author:
bird
Message:

Added psh parameter to the remaining global functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/redir.c

    r1201 r1202  
    225225                                memory[fd] = 1;
    226226                        else
    227                                 copyfd(redir->ndup.dupfd, fd);
     227                                copyfd(psh, redir->ndup.dupfd, fd);
    228228                }
    229229                INTON;
     
    238238
    239239        if (f != fd) {
    240                 copyfd(f, fd);
    241                 close(f);
     240                copyfd(psh, f, fd);
     241                shfile_close(&psh->fdtab, f);
    242242        }
    243243        INTON;
     
    271271                }
    272272        }
    273         if (forkshell((struct job *)NULL, (union node *)NULL, FORK_NOJOB) == 0) {
     273        if (forkshell(psh, (struct job *)NULL, (union node *)NULL, FORK_NOJOB) == 0) {
    274274                close(pip[0]);
    275275                signal(SIGINT, SIG_IGN);
     
    307307                        if (i == 0)
    308308                                fd0_redirected--;
    309                         close(i);
     309                        shfile_close(&psh->fdtab, i);
    310310                        if (rp->renamed[i] >= 0) {
    311                                 copyfd(rp->renamed[i], i);
    312                                 close(rp->renamed[i]);
     311                                copyfd(psh, rp->renamed[i], i);
     312                                shfile_close(&psh->fdtab, rp->renamed[i]);
    313313                        }
    314314                }
     
    330330RESET {
    331331        while (redirlist)
    332                 popredir();
     332                popredir(psh);
    333333}
    334334
    335335SHELLPROC {
    336         clearredir(0);
     336        clearredir(psh, 0);
    337337}
    338338
     
    341341/* Return true if fd 0 has already been redirected at least once.  */
    342342int
    343 fd0_redirected_p () {
    344         return fd0_redirected != 0;
     343fd0_redirected_p(shinstance *psh) {
     344        return psh->fd0_redirected != 0;
    345345}
    346346
     
    376376
    377377int
    378 copyfd(int from, int to)
     378copyfd(shinstance *psh, int from, int to)
    379379{
    380380        int newfd;
    381381
    382         newfd = fcntl(from, F_DUPFD, to);
     382        newfd = shfile_fcntl(psh, from, F_DUPFD, to);
    383383        if (newfd < 0) {
    384384                if (errno == EMFILE)
Note: See TracChangeset for help on using the changeset viewer.