diff -up ksh-20100621/src/cmd/ksh93/sh/subshell.c.orig ksh-20100621/src/cmd/ksh93/sh/subshell.c --- ksh-20100621/src/cmd/ksh93/sh/subshell.c.orig 2013-04-02 10:24:47.706650906 -0500 +++ ksh-20100621/src/cmd/ksh93/sh/subshell.c 2013-04-02 10:27:07.602651596 -0500 @@ -109,7 +109,7 @@ void sh_subtmpfile(Shell_t *shp) register struct checkpt *pp = (struct checkpt*)shp->jmplist; register struct subshell *sp = subshell_data->pipe; /* save file descriptor 1 if open */ - if((sp->tmpfd = fd = fcntl(1,F_DUPFD,10)) >= 0) + if((sp->tmpfd = fd = sh_fcntl(1,F_DUPFD,10)) >= 0) { fcntl(fd,F_SETFD,FD_CLOEXEC); shp->fdstatus[fd] = shp->fdstatus[1]|IOCLEX; diff -up ksh-20100621/src/cmd/ksh93/sh/xec.c.orig ksh-20100621/src/cmd/ksh93/sh/xec.c --- ksh-20100621/src/cmd/ksh93/sh/xec.c.orig 2013-04-02 10:24:21.268900283 -0500 +++ ksh-20100621/src/cmd/ksh93/sh/xec.c 2013-04-02 10:28:25.537656455 -0500 @@ -90,7 +90,7 @@ static void iousepipe(Shell_t *shp) { int i; fcntl(subpipe[0],F_SETFD,FD_CLOEXEC); - subpipe[2] = fcntl(1,F_DUPFD,10); + subpipe[2] = sh_fcntl(1,F_DUPFD,10); fcntl(subpipe[2],F_SETFD,FD_CLOEXEC); shp->fdstatus[subpipe[2]] = shp->fdstatus[1]; close(1); @@ -2961,7 +2961,7 @@ static void coproc_init(Shell_t *shp, in sh_pipe(shp->cpipe); if((outfd=shp->cpipe[1]) < 10) { - int fd=fcntl(shp->cpipe[1],F_DUPFD,10); + int fd=sh_fcntl(shp->cpipe[1],F_DUPFD,10); if(fd>=10) { shp->fdstatus[fd] = (shp->fdstatus[outfd]&~IOCLEX);