From: Maxim Mamontov Date: Mon, 6 Feb 2012 08:47:31 +0000 (+0200) Subject: Check End-Of-Transmission read result X-Git-Tag: 2.408~24 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/d46639a4f8fc1477d848906e20483b66447a146d?hp=--cc Check End-Of-Transmission read result --- d46639a4f8fc1477d848906e20483b66447a146d diff --git a/projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp b/projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp index 421fc7bb..c0b7b325 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp +++ b/projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp @@ -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));