From 30cdb3ac8f24a4c289a3b4e8a41d6c5f2e6ec959 Mon Sep 17 00:00:00 2001
From: Justin Chen <justinchen00@github.invalid.com>
Date: Thu, 14 Apr 2016 21:40:53 +0800
Subject: [PATCH] recv treat zero return as error

https://github.com/warmcat/libwebsockets/issues/475
---
 lib/output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/output.c b/lib/output.c
index 9edc28ff..420146ff 100644
--- a/lib/output.c
+++ b/lib/output.c
@@ -630,7 +630,7 @@ lws_ssl_capable_read_no_ssl(struct lws *wsi, unsigned char *buf, int len)
 	int n;
 
 	n = recv(wsi->sock, (char *)buf, len, 0);
-	if (n >= 0)
+	if (n > 0)
 		return n;
 #if LWS_POSIX
 	if (LWS_ERRNO == LWS_EAGAIN ||
-- 
GitLab