--- ray/src/common/process.c 1992/03/19 09:32:02 2.2 +++ ray/src/common/process.c 2003/02/25 02:47:21 2.6 @@ -1,13 +1,14 @@ -/* Copyright (c) 1991 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: process.c,v 2.6 2003/02/25 02:47:21 greg Exp $"; #endif - /* * Routines to communicate with separate process via dual pipes + * + * External symbols declared in standard.h */ +#include "copyright.h" + /* find pipe buffer limit */ #include @@ -25,7 +26,11 @@ static char SCCSid[] = "$SunId$ LBL"; #include "vfork.h" +#ifndef BSD +#include +#endif + int open_process(pd, av) /* open communication to separate process */ int pd[3]; @@ -100,14 +105,19 @@ int fd; char *bpos; int siz; { - register int cc, nrem = siz; - + register int cc = 0, nrem = siz; +retry: while (nrem > 0 && (cc = read(fd, bpos, nrem)) > 0) { bpos += cc; nrem -= cc; } - if (cc < 0) + if (cc < 0) { +#ifndef BSD + if (errno == EINTR) /* we were interrupted! */ + goto retry; +#endif return(cc); + } return(siz-nrem); } @@ -118,13 +128,18 @@ int fd; char *bpos; int siz; { - register int cc, nrem = siz; - + register int cc = 0, nrem = siz; +retry: while (nrem > 0 && (cc = write(fd, bpos, nrem)) > 0) { bpos += cc; nrem -= cc; } - if (cc < 0) + if (cc < 0) { +#ifndef BSD + if (errno == EINTR) /* we were interrupted! */ + goto retry; +#endif return(cc); + } return(siz-nrem); }