fix: usrsock iovec_do skip empty iov

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu 2022-04-06 20:52:43 +08:00 committed by Xiang Xiao
parent f60480a5db
commit 4c693239c0

View File

@ -143,7 +143,7 @@ static ssize_t iovec_do(FAR void *srcdst, size_t srcdstlen,
/* Rewind to correct position. */
while (pos > 0 && iovcnt > 0)
while (pos >= 0 && iovcnt > 0)
{
if (iov->iov_len <= pos)
{
@ -222,7 +222,7 @@ static ssize_t iovec_do(FAR void *srcdst, size_t srcdstlen,
}
}
return total == 0 && iovcnt == 0 ? -1: total;
return total;
}
/****************************************************************************