summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-03-23 16:00:35 +0000
committerDave Barach <openvpp@barachs.net>2020-03-24 18:32:07 +0000
commiteda1b8c32f9857bb749835b0189af002b224927d (patch)
tree8bb2ac4e783005e7ba0329350f467e65e3c168e1
parent46d0ff3945404f7c95e0e504f98f466e155ab753 (diff)
vcl: fix ldp writev 0 vecs
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iec5db8dcf3a019b731e15fd79d0208d6eb10943b
-rw-r--r--src/vcl/ldp.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c
index 95c0edcff0a..d6e81d6b3b9 100644
--- a/src/vcl/ldp.c
+++ b/src/vcl/ldp.c
@@ -448,24 +448,20 @@ writev (int fd, const struct iovec * iov, int iovcnt)
vlsh = ldp_fd_to_vlsh (fd);
if (vlsh != VLS_INVALID_HANDLE)
{
- do
+ for (i = 0; i < iovcnt; ++i)
{
- for (i = 0; i < iovcnt; ++i)
+ rv = vls_write_msg (vlsh, iov[i].iov_base, iov[i].iov_len);
+ if (rv < 0)
+ break;
+ else
{
- rv = vls_write_msg (vlsh, iov[i].iov_base, iov[i].iov_len);
- if (rv < 0)
+ total += rv;
+ if (rv < iov[i].iov_len)
break;
- else
- {
- total += rv;
- if (rv < iov[i].iov_len)
- break;
- }
}
}
- while ((rv >= 0) && (total == 0));
- if (rv < 0)
+ if (rv < 0 && total == 0)
{
errno = -rv;
size = -1;