summaryrefslogtreecommitdiff
path: root/zebra/zebra_ptm.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-07-19 08:50:01 -0400
committerGitHub <noreply@github.com>2018-07-19 08:50:01 -0400
commitd1a85fe40d93d31f7f0daf54912a159fcabfaddc (patch)
treee947467da69832a04e10e24334e4fbc06285884d /zebra/zebra_ptm.c
parent06a5959f10f30740dcdf7d09a9c77f1504fc3328 (diff)
parent2e1cc436791c3d2e39af9ffbd8194e9e4abc7795 (diff)
Merge pull request #2608 from pacovn/PVS-Studio_dead_code_1
eigrpd lib pimd zebra: dead code (PVS-Studio)
Diffstat (limited to 'zebra/zebra_ptm.c')
-rw-r--r--zebra/zebra_ptm.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index 8c23bf34cf..5975c4058b 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -615,7 +615,7 @@ static int zebra_ptm_handle_msg_cb(void *arg, void *in_ctxt)
int zebra_ptm_sock_read(struct thread *thread)
{
- int sock, done = 0;
+ int sock;
int rc;
errno = 0;
@@ -625,28 +625,24 @@ int zebra_ptm_sock_read(struct thread *thread)
return -1;
/* PTM communicates in CSV format */
- while (!done) {
+ do {
rc = ptm_lib_process_msg(ptm_hdl, sock, ptm_cb.in_data,
ZEBRA_PTM_MAX_SOCKBUF, NULL);
- if (rc <= 0)
- break;
- }
+ } while (rc > 0);
- if (rc <= 0) {
- if (((rc == 0) && !errno)
- || (errno && (errno != EWOULDBLOCK) && (errno != EAGAIN))) {
- zlog_warn("%s routing socket error: %s(%d) bytes %d",
- __func__, safe_strerror(errno), errno, rc);
-
- close(ptm_cb.ptm_sock);
- ptm_cb.ptm_sock = -1;
- zebra_ptm_reset_status(0);
- ptm_cb.t_timer = NULL;
- thread_add_timer(zebrad.master, zebra_ptm_connect, NULL,
- ptm_cb.reconnect_time,
- &ptm_cb.t_timer);
- return (-1);
- }
+ if (((rc == 0) && !errno)
+ || (errno && (errno != EWOULDBLOCK) && (errno != EAGAIN))) {
+ zlog_warn("%s routing socket error: %s(%d) bytes %d",
+ __func__, safe_strerror(errno), errno, rc);
+
+ close(ptm_cb.ptm_sock);
+ ptm_cb.ptm_sock = -1;
+ zebra_ptm_reset_status(0);
+ ptm_cb.t_timer = NULL;
+ thread_add_timer(zebrad.master, zebra_ptm_connect, NULL,
+ ptm_cb.reconnect_time,
+ &ptm_cb.t_timer);
+ return (-1);
}
ptm_cb.t_read = NULL;