aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMichael Tokarev <mjt@tls.msk.ru>2013-09-14 13:11:36 +0400
committerMichael Tokarev <mjt@tls.msk.ru>2013-09-20 20:09:24 +0400
commit2be178a475289286db80de5ddd7830e67e112bdd (patch)
tree66b217ac81e986eed19f1370954202f54fc972ac /util
parent69fded480e335ecfe877e2c37de0eff265fced12 (diff)
iov: avoid "orig_len may be used unitialized" warning
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'util')
-rw-r--r--util/iov.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/util/iov.c b/util/iov.c
index f705586808..bb46c04e4d 100644
--- a/util/iov.c
+++ b/util/iov.c
@@ -181,13 +181,11 @@ ssize_t iov_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt,
assert(iov[niov].iov_len > tail);
orig_len = iov[niov].iov_len;
iov[niov++].iov_len = tail;
- }
-
- ret = do_send_recv(sockfd, iov, niov, do_send);
-
- /* Undo the changes above before checking for errors */
- if (tail) {
+ ret = do_send_recv(sockfd, iov, niov, do_send);
+ /* Undo the changes above before checking for errors */
iov[niov-1].iov_len = orig_len;
+ } else {
+ ret = do_send_recv(sockfd, iov, niov, do_send);
}
if (offset) {
iov[0].iov_base -= offset;