Merge pull request #2608 from pacovn/PVS-Studio_dead_code_1

eigrpd lib pimd zebra: dead code (PVS-Studio)
This commit is contained in:
Donald Sharp 2018-07-19 08:50:01 -04:00 committed by GitHub
commit d1a85fe40d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 31 deletions

View File

@ -549,8 +549,7 @@ static int vty_access_list_remark_unset(struct vty *vty, afi_t afi,
access->remark = NULL; access->remark = NULL;
} }
if (access->head == NULL && access->tail == NULL if (access->head == NULL && access->tail == NULL)
&& access->remark == NULL)
access_list_delete(access); access_list_delete(access);
return CMD_SUCCESS; return CMD_SUCCESS;

View File

@ -85,7 +85,7 @@ struct frrmod_runtime *frrmod_load(const char *spec, const char *dir, char *err,
*args++ = '\0'; *args++ = '\0';
if (!strchr(name, '/')) { if (!strchr(name, '/')) {
if (!handle && execname) { if (execname) {
snprintf(fullpath, sizeof(fullpath), "%s/%s_%s.so", dir, snprintf(fullpath, sizeof(fullpath), "%s/%s_%s.so", dir,
execname, name); execname, name);
handle = dlopen(fullpath, RTLD_NOW | RTLD_GLOBAL); handle = dlopen(fullpath, RTLD_NOW | RTLD_GLOBAL);

View File

@ -628,7 +628,7 @@ int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname,
} }
if (vrf->ns_ctxt != NULL) { if (vrf->ns_ctxt != NULL) {
ns = (struct ns *)vrf->ns_ctxt; ns = (struct ns *)vrf->ns_ctxt;
if (ns && 0 != strcmp(ns->name, pathname)) { if (!strcmp(ns->name, pathname)) {
if (vty) if (vty)
vty_out(vty, vty_out(vty,
"VRF %u already configured with NETNS %s\n", "VRF %u already configured with NETNS %s\n",
@ -661,8 +661,7 @@ int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname,
ns->vrf_ctxt = (void *)vrf; ns->vrf_ctxt = (void *)vrf;
vrf->ns_ctxt = (void *)ns; vrf->ns_ctxt = (void *)ns;
/* update VRF netns NAME */ /* update VRF netns NAME */
if (vrf) strlcpy(vrf->data.l.netns_name, basename(pathname), NS_NAMSIZ);
strlcpy(vrf->data.l.netns_name, basename(pathname), NS_NAMSIZ);
if (!ns_enable(ns, vrf_update_vrf_id)) { if (!ns_enable(ns, vrf_update_vrf_id)) {
if (vty) if (vty)

View File

@ -136,9 +136,8 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch)
mask = PIM_OIF_FLAG_PROTO_IGMP; mask = PIM_OIF_FLAG_PROTO_IGMP;
/* SGRpt entry could have empty oil */ /* SGRpt entry could have empty oil */
if (ch->upstream->channel_oil) pim_channel_del_oif(ch->upstream->channel_oil, ch->interface,
pim_channel_del_oif(ch->upstream->channel_oil, mask);
ch->interface, mask);
/* /*
* Do we have any S,G's that are inheriting? * Do we have any S,G's that are inheriting?
* Nuke from on high too. * Nuke from on high too.

View File

@ -909,10 +909,9 @@ static int pim_igmp_read(struct thread *t)
socklen_t fromlen = sizeof(from); socklen_t fromlen = sizeof(from);
socklen_t tolen = sizeof(to); socklen_t tolen = sizeof(to);
ifindex_t ifindex = -1; ifindex_t ifindex = -1;
int cont = 1;
int len; int len;
while (cont) { while (1) {
len = pim_socket_recvfromto(igmp->fd, buf, sizeof(buf), &from, len = pim_socket_recvfromto(igmp->fd, buf, sizeof(buf), &from,
&fromlen, &to, &tolen, &ifindex); &fromlen, &to, &tolen, &ifindex);
if (len < 0) { if (len < 0) {

View File

@ -986,7 +986,7 @@ int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if (tb[IFA_LABEL]) if (tb[IFA_LABEL])
label = (char *)RTA_DATA(tb[IFA_LABEL]); label = (char *)RTA_DATA(tb[IFA_LABEL]);
if (ifp && label && strcmp(ifp->name, label) == 0) if (label && strcmp(ifp->name, label) == 0)
label = NULL; label = NULL;
/* Register interface address to the interface. */ /* Register interface address to the interface. */

View File

@ -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 zebra_ptm_sock_read(struct thread *thread)
{ {
int sock, done = 0; int sock;
int rc; int rc;
errno = 0; errno = 0;
@ -625,28 +625,24 @@ int zebra_ptm_sock_read(struct thread *thread)
return -1; return -1;
/* PTM communicates in CSV format */ /* PTM communicates in CSV format */
while (!done) { do {
rc = ptm_lib_process_msg(ptm_hdl, sock, ptm_cb.in_data, rc = ptm_lib_process_msg(ptm_hdl, sock, ptm_cb.in_data,
ZEBRA_PTM_MAX_SOCKBUF, NULL); ZEBRA_PTM_MAX_SOCKBUF, NULL);
if (rc <= 0) } while (rc > 0);
break;
}
if (rc <= 0) { if (((rc == 0) && !errno)
if (((rc == 0) && !errno) || (errno && (errno != EWOULDBLOCK) && (errno != EAGAIN))) {
|| (errno && (errno != EWOULDBLOCK) && (errno != EAGAIN))) { zlog_warn("%s routing socket error: %s(%d) bytes %d",
zlog_warn("%s routing socket error: %s(%d) bytes %d", __func__, safe_strerror(errno), errno, rc);
__func__, safe_strerror(errno), errno, rc);
close(ptm_cb.ptm_sock); close(ptm_cb.ptm_sock);
ptm_cb.ptm_sock = -1; ptm_cb.ptm_sock = -1;
zebra_ptm_reset_status(0); zebra_ptm_reset_status(0);
ptm_cb.t_timer = NULL; ptm_cb.t_timer = NULL;
thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, thread_add_timer(zebrad.master, zebra_ptm_connect, NULL,
ptm_cb.reconnect_time, ptm_cb.reconnect_time,
&ptm_cb.t_timer); &ptm_cb.t_timer);
return (-1); return (-1);
}
} }
ptm_cb.t_read = NULL; ptm_cb.t_read = NULL;