diff options
author | Florin Coras <fcoras@cisco.com> | 2020-03-23 16:00:35 +0000 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2020-08-13 10:39:40 +0000 |
commit | a086cb867407660558b3c7ed6690738ff3240cea (patch) | |
tree | 1e64402d54c3787605db7babcce260c56e25d939 /src | |
parent | e896fcf6102906fea187251e08f850c60b6db2d6 (diff) |
vcl: fix ldp writev 0 vecs
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Iec5db8dcf3a019b731e15fd79d0208d6eb10943b
(cherry picked from commit eda1b8c32f9857bb749835b0189af002b224927d)
Diffstat (limited to 'src')
-rw-r--r-- | src/vcl/ldp.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c index a4151be9f2e..47ad0f8a9e1 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; |