--- ray/src/common/unix_process.c 2016/03/04 19:16:49 3.12 +++ ray/src/common/unix_process.c 2019/05/14 18:37:36 3.14 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: unix_process.c,v 3.12 2016/03/04 19:16:49 greg Exp $"; +static const char RCSid[] = "$Id: unix_process.c,v 3.14 2019/05/14 18:37:36 greg Exp $"; #endif /* * Routines to communicate with separate process via dual pipes @@ -37,7 +37,13 @@ char *av[] return(0); if (pipe(p0) < 0 || pipe(p1) < 0) return(-1); - if ((pd->pid = fork()) == 0) { /* if child... */ +#ifdef BSD + if (compath != NULL) + pd->pid = vfork(); /* more efficient with exec() */ + else +#endif + pd->pid = fork(); + if (pd->pid == 0) { /* if child... */ close(p0[1]); close(p1[0]); if (p0[0] != 0) { /* connect p0 to stdin */ @@ -88,7 +94,8 @@ int nproc close(pd[i].w); close(pd[i].r); pd[i].running = 0; - } + } else + togo -= (pd[i].pid < 0); if (nproc == 1) { /* await specific process? */ if (waitpid(pd->pid, &status, 0) != pd->pid) return(-1);