[OpenWrt-Devel] [PATCH 4/7] libubus: fix writev_retry() function when writing large packets

Alexandru Ardelean ardeleanalex at gmail.com
Fri Jun 27 12:11:42 EDT 2014


Seems this bug stayed hidden for a while, because the write/sendmsg function
can send up to ~200k in one send, so it looked at first why there was
some data mismatch.

---
 libubus-io.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libubus-io.c b/libubus-io.c
index f38403f..31dad27 100644
--- a/libubus-io.c
+++ b/libubus-io.c
@@ -111,7 +111,10 @@ static int writev_retry(int fd, struct iovec *iov, int iov_len, int sock_fd)
 			if (!iov_len)
 				return len;
 		}
+		iov->iov_base += cur_len;
 		iov->iov_len -= cur_len;
+		msghdr.msg_iov = iov;
+		msghdr.msg_iovlen = iov_len;
 	} while (1);
 
 	/* Should never reach here */
-- 
1.8.4.5
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list