summaryrefslogtreecommitdiff
path: root/lib/ptm_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ptm_lib.c')
-rw-r--r--lib/ptm_lib.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/ptm_lib.c b/lib/ptm_lib.c
index ac800be0a5..737c60775f 100644
--- a/lib/ptm_lib.c
+++ b/lib/ptm_lib.c
@@ -308,22 +308,18 @@ static int _ptm_lib_read_ptm_socket(int fd, char *buf, int len)
while (bytes_read != len) {
rc = recv(fd, (void *)(buf + bytes_read), (len - bytes_read),
MSG_DONTWAIT);
- if (rc <= 0) {
- if (errno && (errno != EAGAIN)
- && (errno != EWOULDBLOCK)) {
- ERRLOG("fatal recv error(%s), closing connection, rc %d\n",
- strerror(errno), rc);
- return (rc);
- } else {
- if (retries++ < 2) {
- usleep(10000);
- continue;
- }
- DLOG("max retries - recv error(%d - %s) bytes read %d (%d)\n",
- errno, strerror(errno), bytes_read, len);
- return (bytes_read);
+ if (rc < 0 && (errno != EAGAIN) && (errno != EWOULDBLOCK)) {
+ ERRLOG("fatal recv error(%s), closing connection, rc %d\n", strerror(errno),
+ rc);
+ return (rc);
+ } else if (rc <= 0) {
+ if (retries++ < 2) {
+ usleep(10000);
+ continue;
}
- break;
+ DLOG("max retries - recv error(%d - %s) bytes read %d (%d)\n", errno,
+ strerror(errno), bytes_read, len);
+ return (bytes_read);
} else {
bytes_read += rc;
}