diff --git a/src/cmd/ksh93/sh/args.c b/src/cmd/ksh93/sh/args.c index 5756ec412..527639d4d 100644 --- a/src/cmd/ksh93/sh/args.c +++ b/src/cmd/ksh93/sh/args.c @@ -36,8 +36,10 @@ #include "FEATURE/poll" #if SHOPT_KIA # include "shlex.h" +#endif +#if SHOPT_KIA || SHOPT_DEVFD # include "io.h" -#endif /* SHOPT_KIA */ +#endif #if SHOPT_PFSH # define PFSHOPT "P" #else @@ -701,12 +703,15 @@ struct argnod *sh_argprocsub(Shell_t *shp,struct argnod *argp) sh_pipe(pv); #else pv[0] = -1; - while((shp->fifo = pathtemp(0,0,0,"ksh.fifo",0), mkfifo(shp->fifo,0))<0) + while(shp->fifo = pathtemp(0,0,0,"ksh.fifo",0), shp->fifo && mkfifo(shp->fifo,0)<0) { if(errno==EEXIST || errno==EACCES || errno==ENOENT || errno==ENOTDIR || errno==EROFS) continue; /* lost race (name conflict or tmp dir change); try again */ - errormsg(SH_DICT,ERROR_system(128),"process substitution: FIFO creation failed"); + shp->fifo = 0; + break; } + if(!shp->fifo) + errormsg(SH_DICT,ERROR_system(128),"process substitution: FIFO creation failed"); chmod(shp->fifo,S_IRUSR|S_IWUSR); /* mkfifo + chmod works regardless of umask */ sfputr(shp->stk,shp->fifo,0); #endif /* SHOPT_DEVFD */