summaryrefslogtreecommitdiff
path: root/misc/team/patches/patch-d
diff options
context:
space:
mode:
Diffstat (limited to 'misc/team/patches/patch-d')
-rw-r--r--misc/team/patches/patch-d146
1 files changed, 146 insertions, 0 deletions
diff --git a/misc/team/patches/patch-d b/misc/team/patches/patch-d
new file mode 100644
index 00000000000..53b4698adb0
--- /dev/null
+++ b/misc/team/patches/patch-d
@@ -0,0 +1,146 @@
+*** Makefile.ORIG Fri Dec 13 16:26:46 1996
+--- Makefile Sat Dec 14 11:01:06 1996
+***************
+*** 3,8 ****
+ BINDIR= ${PREFIX}/bin
+ MANDIR= ${PREFIX}/man/man
+
+! CFLAGS+= -DHAVE_PARAM_H
+
+ .include <bsd.prog.mk>
+--- 3,8 ----
+ BINDIR= ${PREFIX}/bin
+ MANDIR= ${PREFIX}/man/man
+
+! CFLAGS+= -DHAVE_PARAM_H -DHAVE_WAIT_H
+
+ .include <bsd.prog.mk>
+*** team.c.ORIG Fri Dec 13 16:26:50 1996
+--- team.c Sun Dec 15 10:35:10 1996
+***************
+*** 84,89 ****
+--- 84,92 ----
+ #include <sys/file.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
++ #ifdef HAVE_WAIT_H
++ #include <sys/wait.h>
++ #endif
+
+ #ifdef HAVE_PARAM_H
+ #include <sys/param.h>
+***************
+*** 165,170 ****
+--- 168,174 ----
+
+ local bool verbose = false;
+ local bool report = true;
++ local bool guyhaderror = false;
+
+ extern int errno;
+ local time_t origin;
+***************
+*** 647,653 ****
+ {
+ mesg("team: guy pid %u: %s\n",guy->pid,errormsg);
+ call GuySEND(guy,TokenABORT,FdERROR,0L);
+! exit(1);
+ /*NOTREACHED*/
+ }
+
+--- 651,657 ----
+ {
+ mesg("team: guy pid %u: %s\n",guy->pid,errormsg);
+ call GuySEND(guy,TokenABORT,FdERROR,0L);
+! exit(2);
+ /*NOTREACHED*/
+ }
+
+***************
+*** 807,812 ****
+--- 811,819 ----
+ {
+ pid = getpid();
+
++ /* Set SIGPIPE handling back to the default in the guys */
++ signal(SIGPIPE, SIG_DFL);
++
+ if (!FdClose(&last_downstream))
+ perror("cannot close inherited first link");
+
+***************
+*** 826,838 ****
+ }
+ }
+
+! if (!StreamSend(&last_downstream,TokenREAD,FdOPEN,0L))
+ {
+ perror("cannot send first READ token");
+ return false;
+ }
+
+! if (!StreamSend(&last_downstream,TokenWRITE,FdOPEN,0L))
+ {
+ perror("cannot send first WRITE token");
+ return false;
+--- 833,845 ----
+ }
+ }
+
+! if (!StreamSend(&last_downstream,TokenREAD,FdOPEN,0L) && errno != EPIPE)
+ {
+ perror("cannot send first READ token");
+ return false;
+ }
+
+! if (!StreamSend(&last_downstream,TokenWRITE,FdOPEN,0L) && errno != EPIPE)
+ {
+ perror("cannot send first WRITE token");
+ return false;
+***************
+*** 874,879 ****
+--- 881,894 ----
+
+ --team->active;
+
++ #ifdef WIFEXITED
++ /* If a guy had an error, its exit status is 2. Also catch a killed guy */
++ if ((WIFEXITED(status) && WEXITSTATUS(status) == 2) ||
++ (WIFSIGNALED(status) && WTERMSIG(status) != SIGPIPE)) {
++ guyhaderror = true;
++ }
++ #endif
++
+ if (status != 0 && team->active != 0)
+ return false;
+ }
+***************
+*** 1042,1047 ****
+--- 1057,1067 ----
+
+ origin = time((time_t *) 0);
+
++ /*
++ * Ignore SIGPIPE in the parent as it affects the exit status reporting.
++ */
++ signal(SIGPIPE, SIG_IGN);
++
+ if (!TeamStart(&team,bufsize,isize,osize))
+ {
+ mesg("team: cannot start the team\n");
+***************
+*** 1062,1067 ****
+--- 1082,1093 ----
+ if (!TeamClose(&team))
+ {
+ mesg("team: cannot close the team\n");
++ return 1;
++ }
++
++ if (guyhaderror)
++ {
++ mesg("team: guy had error\n");
+ return 1;
+ }
+
+