summaryrefslogtreecommitdiffstats
path: root/src/vcl/vcom_socket.c
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2017-10-24 20:47:45 -0400
committerDave Wallace <dwallacelf@gmail.com>2017-10-24 20:47:45 -0400
commit60f54822b78dea6b87cde5da82a4a135e7c2b960 (patch)
tree66e5cba28eb2f670bf88ebe9ce89e83a71922782 /src/vcl/vcom_socket.c
parent5c7cf1cc5358d137160be1619981e7eea9a7402f (diff)
VCL-LDPRELOAD: Fix coverity warnings.
- CID 178225: Constant expression result - CID 178220: Logically dead code - CID 178222: Logically dead code - CID 178227: Logically dead code - CID 178223: Same on both sides - CID 178226: Same on both sides Change-Id: Ie0c80edb41390cf2308e54938be85d865e292138 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'src/vcl/vcom_socket.c')
-rw-r--r--src/vcl/vcom_socket.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/vcl/vcom_socket.c b/src/vcl/vcom_socket.c
index 8806ebd011a..1ccb05451ad 100644
--- a/src/vcl/vcom_socket.c
+++ b/src/vcl/vcom_socket.c
@@ -465,6 +465,7 @@ vcom_socket_read (int __fd, void *__buf, size_t __nbytes)
{
rv = vppcom_session_read (vsock->sid, __buf, __nbytes);
}
+ /* coverity[CONSTANT_EXPRESSION_RESULT] */
while (rv == -EAGAIN || rv == -EWOULDBLOCK);
return rv;
}
@@ -535,6 +536,7 @@ vcom_socket_readv (int __fd, const struct iovec * __iov, int __iovcnt)
}
}
}
+ /* coverity[CONSTANT_EXPRESSION_RESULT] */
while ((rv == -EAGAIN || rv == -EWOULDBLOCK) && total == 0);
return total;
}
@@ -1561,7 +1563,8 @@ vcom_socket_sendto (int __fd, const void *__buf, size_t __n,
return -EDESTADDRREQ;
}
/* not a vppcom supported address family */
- if ((__addr->sa_family != AF_INET) || (__addr->sa_family != AF_INET6))
+ if (!((__addr->sa_family == AF_INET) ||
+ (__addr->sa_family == AF_INET6)))
{
return -EINVAL;
}
@@ -3151,13 +3154,9 @@ vcom_socket_poll_vppcom_impl (struct pollfd *__fds, nfds_t __nfds,
{
time_to_wait = (double) 0;
}
- else if (__timeout < 0)
- {
- time_to_wait = ~0;
- }
else
{
- return -EBADF;
+ time_to_wait = ~0;
}
return vppcom_poll (__fds, __nfds, time_to_wait);
@@ -3332,9 +3331,10 @@ vcom_socket_main_destroy (void)
/* *INDENT-OFF* */
pool_flush (vepitem, vsm->vepitems,
({
- if (vepitem->type == FD_TYPE_EPOLL || FD_TYPE_VCOM_SOCKET)
+ if ((vepitem->type == FD_TYPE_EPOLL) ||
+ (vepitem->type == FD_TYPE_VCOM_SOCKET))
{
- vcom_socket_epoll_ctl1 (vepitem->epfd, EPOLL_CTL_DEL,
+ vcom_socket_epoll_ctl1 (vepitem->epfd, EPOLL_CTL_DEL,
vepitem->fd, NULL);
vepitem_init (vepitem);
}