--- ray/src/rt/persist.c 1997/11/07 12:12:53 2.22 +++ ray/src/rt/persist.c 1997/11/24 15:13:33 2.24 @@ -1,7 +1,7 @@ -/* Copyright (c) 1996 Regents of the University of California */ +/* Copyright (c) 1997 Silicon Graphics, Inc. */ #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static char SCCSid[] = "$SunId$ SGI"; #endif /* @@ -170,6 +170,7 @@ io_process() /* just act as go-between for actual pro char buf[BUFSIZ], *pfin, *pfout, *pferr; int pid, nfds; int fdout, fderr = -1; + int status = 0; fd_set readfds, excepfds; /* load persist file */ n = 40; @@ -268,12 +269,28 @@ io_process() /* just act as go-between for actual pro close(fderr); /* close(2); don't close stderr! */ fderr = -1; - } else - do { /* write it all */ + } else { + cp[nr] = '\0'; /* deduce status if we can */ + n = strlen(progname); + if (!strncmp(cp, progname, n) && + cp[n++] == ':' && + cp[n++] == ' ') { + register struct erract *ep; + for (ep = erract; ep < erract+NERRS; + ep++) + if (ep->pre[0] && + !strncmp(cp+n, ep->pre, + strlen(ep->pre))) { + status = ep->ec; + break; + } + } + do { /* write message */ if ((n = write(2, cp, nr)) <= 0) goto writerr; cp += n; } while ((nr -= n) > 0); + } } /* renderer stdout */ if (fdout >= 0 && (FD_ISSET(fdout, &readfds) || @@ -293,7 +310,8 @@ io_process() /* just act as go-between for actual pro } while ((nr -= n) > 0); } } - _exit(0); /* we ought to return renderer error status! */ + wait(0); /* wait for feeder process */ + _exit(status); formerr: error(USER, "format error in persist file"); readerr: