diff options
author | 2020-02-14 05:33:46 +0000 | |
---|---|---|
committer | 2020-08-12 15:59:46 +0000 | |
commit | e0208837b53362b343b44275d281ba5cb76a79b6 (patch) | |
tree | e378b96d70cbcb41bab87007160ee567a2228e93 /src/vcl/ldp.c | |
parent | 0bd543b2a93c01b08d2b60ad6efd2ca1bf1c069a (diff) |
vcl: fix ldp read on closing session
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I60be191866d20721951ad22f571a2a3275511e12
(cherry picked from commit 067f9544d52c95c0b60b0e8425fce1e295120180)
Diffstat (limited to 'src/vcl/ldp.c')
-rw-r--r-- | src/vcl/ldp.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c index 34eba377451..a4151be9f2e 100644 --- a/src/vcl/ldp.c +++ b/src/vcl/ldp.c @@ -380,24 +380,19 @@ readv (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_read (vlsh, iov[i].iov_base, iov[i].iov_len); + if (rv <= 0) + break; + else { - rv = vls_read (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; |