]> git.stg.codes - stg.git/commitdiff
Check End-Of-Transmission read result
authorMaxim Mamontov <faust.madf@gmail.com>
Mon, 6 Feb 2012 08:47:31 +0000 (10:47 +0200)
committerMaxim Mamontov <faust.madf@gmail.com>
Mon, 6 Feb 2012 08:47:31 +0000 (10:47 +0200)
projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp

index 421fc7bbeb7bb7e625895aacbb1ace302b5ba88c..c0b7b325ba8659123ea9f4d2224ef6bf9cc71029 100644 (file)
@@ -250,7 +250,7 @@ while (pos < stgHdrLen)
         return -1;
         }
     int ret = recv(sock, &buf[pos], stgHdrLen - pos, 0);
-    if (ret < 0)
+    if (ret <= 0)
         {
         state = confHdr;
         return -1;
@@ -310,7 +310,7 @@ while (pos < ADM_LOGIN_LEN) {
 
     int ret = recv(sock, &login[pos], ADM_LOGIN_LEN - pos, 0);
 
-    if (ret < 0)
+    if (ret <= 0)
         {
         // Error in network
         state = confHdr;
@@ -359,7 +359,7 @@ while (pos < ADM_LOGIN_LEN)
 
     int ret = recv(sock, &loginS[pos], ADM_LOGIN_LEN - pos, 0);
 
-    if (ret < 0)
+    if (ret <= 0)
         {
         // Network error
         printfd(__FILE__, "recv error: '%s'\n", strerror(errno));