iob: iob_clone_partial support Negative offset

make the function can correctly handle negative offset cases

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu 2023-04-23 10:47:02 +08:00 committed by Xiang Xiao
parent c31e869fac
commit 69667e2c73
1 changed files with 1 additions and 1 deletions

View File

@ -140,7 +140,7 @@ int iob_clone_partial(FAR struct iob_s *iob1, unsigned int len,
while (iob2 != NULL)
{
avail2 = CONFIG_IOB_BUFSIZE - iob2->io_offset;
if (offset2 < avail2)
if ((int)(offset2 - avail2) < 0)
{
break;
}