diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-26 23:30:31 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-05-12 13:02:05 -0600 |
commit | 42729f477684b12735b572a4975d32fb1002a530 (patch) | |
tree | 8edcd3eede207af6d9ae2557f8fcb05290659597 /libhw_cr/host_net.c | |
parent | 5255dbd5196f0125b51d969c46e46ac5765db7ed (diff) |
libhw_generic: io.h: Clarify that sum lenghts of iovecs must not be 0
Diffstat (limited to 'libhw_cr/host_net.c')
-rw-r--r-- | libhw_cr/host_net.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libhw_cr/host_net.c b/libhw_cr/host_net.c index 01f4370..d162504 100644 --- a/libhw_cr/host_net.c +++ b/libhw_cr/host_net.c @@ -241,6 +241,10 @@ static ssize_t hostnet_tcp_readv(struct _hostnet_tcp_conn *conn, const struct io assert(conn); assert(iov); assert(iovcnt > 0); + size_t count = 0; + for (int i = 0; i < iovcnt; i++) + count += iov[i].iov_len; + assert(count); ssize_t ret; struct hostnet_pthread_readv_args args = { @@ -319,6 +323,10 @@ static ssize_t hostnet_tcp_writev(struct _hostnet_tcp_conn *conn, const struct i assert(conn); assert(iov); assert(iovcnt > 0); + size_t count = 0; + for (int i = 0; i < iovcnt; i++) + count += iov[i].iov_len; + assert(count); ssize_t ret; struct hostnet_pthread_writev_args args = { |