--- ray/src/common/unix_process.c 2004/09/17 21:43:49 3.5 +++ ray/src/common/unix_process.c 2005/01/20 04:08:00 3.7 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: unix_process.c,v 3.5 2004/09/17 21:43:49 greg Exp $"; +static const char RCSid[] = "$Id: unix_process.c,v 3.7 2005/01/20 04:08:00 greg Exp $"; #endif /* * Routines to communicate with separate process via dual pipes @@ -12,8 +12,11 @@ static const char RCSid[] = "$Id: unix_process.c,v 3.5 #include #include +#include +#include #include "rtprocess.h" +#include "rtio.h" int @@ -22,7 +25,6 @@ SUBPROC *pd, char *av[] ) { - extern char *getpath(), *getenv(); char *compath; int p0[2], p1[2]; @@ -54,6 +56,13 @@ char *av[] close(p1[1]); pd->r = p1[0]; pd->w = p0[1]; + /* + * Close write stream on exec to avoid multiprocessing deadlock. + * No use in read stream without it, so set flag there as well. + * GW: This bug took me two days to figure out!! + */ + fcntl(pd->r, F_SETFD, FD_CLOEXEC); + fcntl(pd->w, F_SETFD, FD_CLOEXEC); pd->running = 1; return(PIPE_BUF); }