From: Michael Tokarev Date: Sat, 14 Sep 2013 09:11:36 +0000 (+0400) Subject: iov: avoid "orig_len may be used unitialized" warning X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~1335^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2be178a475289286db80de5ddd7830e67e112bdd;p=sdk%2Femulator%2Fqemu.git iov: avoid "orig_len may be used unitialized" warning Signed-off-by: Wenchao Xia Reviewed-by: Stefan Hajnoczi Signed-off-by: Michael Tokarev --- diff --git a/util/iov.c b/util/iov.c index f705586..bb46c04 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;