Commit Diff


commit - 303cb7c6dbb49fd57cb97af77f93fab620eee8d7
commit + f0264abf2684f96c011ad56b292378a67074c148
blob - c7371812fab87f08df28d322bc2549ebc6dd0377
blob + 09b492a6ed7e23c33372549036ebc54458561f06
--- src/cmd/samterm/mesg.c
+++ src/cmd/samterm/mesg.c
@@ -17,6 +17,7 @@ uchar	outdata[DATASIZE];
 short	outcount;
 int	hversion;
 int	hostfd[2];
+int	exiting;
 
 void	inmesg(Hmesg, int);
 int	inshort(int);
@@ -29,6 +30,7 @@ void	hplumb(int);
 void	clrlock(void);
 int	snarfswap(char*, int, char**);
 
+
 void
 rcv(void)
 {
@@ -298,6 +300,7 @@ inmesg(Hmesg type, int count)
 		break;
 
 	case Hexit:
+		exiting = 1;
 		outT0(Texit);
 		threadexitsall(nil);
 		break;
blob - 5f5c33d07068f036e6824465635725bcac5be212
blob + 3d2df85d01ecf6fed9e44eb22ddc75392e526db8
--- src/cmd/samterm/plan9.c
+++ src/cmd/samterm/plan9.c
@@ -279,6 +279,11 @@ hostproc(void *arg)
 		n = read(hostfd[0], hostbuf[i].data, sizeof hostbuf[i].data);
 if(0) fprint(2, "hostproc %d\n", n);
 		if(n <= 0){
+			if(n == 0){
+				if(exiting)
+					threadexits(nil);
+				werrstr("unexpected eof");
+			}
 			fprint(2, "samterm: host read error: %r\n");
 			threadexitsall("host");
 		}
blob - 68e2dbb61499049eba15b9738905a29045af1737
blob + dfe2f345be0ca60b226063459c5455b8cbb709e7
--- src/cmd/samterm/samterm.h
+++ src/cmd/samterm/samterm.h
@@ -87,6 +87,7 @@ extern Channel *hostc;
 extern int	hversion;
 extern int	plumbfd;
 extern int	hostfd[2];
+extern int	exiting;
 
 #define gettext sam_gettext	/* stupid gcc built-in functions */
 Rune	*gettext(Flayer*, long, ulong*);