summaryrefslogtreecommitdiff
path: root/lib/ptm_lib.c
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2024-10-17 07:38:28 -0400
committerGitHub <noreply@github.com>2024-10-17 07:38:28 -0400
commit466efab870d20ba4cfde3a27f80ae3dcfa96c84a (patch)
tree529dc019ee2639e6c2c8606c09b813c2001114be /lib/ptm_lib.c
parent5fecb1f425507eb216abbf0424d7430640469b55 (diff)
parentb5f196c35a6d24a826fc087ce9de04af88ffb42b (diff)
Merge pull request #17136 from opensourcerouting/clang-sa-19
*: fix clang-19 SA
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;
}