aboutsummaryrefslogtreecommitdiffstats
path: root/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'socket.c')
-rw-r--r--socket.c3
1 files changed, 2 insertions, 1 deletions
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)
{