diff --git a/appl/rsh/rsh.c b/appl/rsh/rsh.c index f518b99d6..27371f862 100644 --- a/appl/rsh/rsh.c +++ b/appl/rsh/rsh.c @@ -467,10 +467,15 @@ proto (int s, int errsock, return 1; } - if (net_read (s, &reply, 1) != 1) { + ret = net_read (s, &reply, 1); + if (ret < 0) { warn ("read"); close (errsock2); return 1; + } else if (ret == 0) { + warnx ("unexpected EOF from %s", hostname); + close (errsock2); + return 1; } if (reply != 0) {