From 6a1b0f83e980b788b15054cc7d3223a8d0ed83ab Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 18 Feb 1997 02:35:30 +0000 Subject: Janos Farkas's fixes. svn path=/trunk/; revision=897 --- socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'socket.c') diff --git a/socket.c b/socket.c index 6b2076e7..e5b9ba5c 100644 --- a/socket.c +++ b/socket.c @@ -118,7 +118,8 @@ char *SockGets(char *buf, int len, FILE *sockfp) if (--len < 1) return NULL; do { - if ((n = recv(fileno(sockfp), bp, len, MSG_PEEK)) == -1) + /* return value of 0 is EOF, < 0 is error */ + if ((n = recv(fileno(sockfp), bp, len, MSG_PEEK)) <= 0) return NULL; if ((p = memchr(bp, '\n', n)) != NULL) { -- cgit v1.2.3