--- ray/src/common/process.c 1991/07/23 15:56:57 1.1 +++ 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 @@ -23,8 +24,10 @@ static char SCCSid[] = "$SunId$ LBL"; #endif #endif +#include "vfork.h" + #ifndef BSD -#define vfork fork +#include #endif @@ -102,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); } @@ -120,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); }