system/ymodem: fix send err when partial write

Fix buffer offset calculation in ymodem_send_buffer() to correctly
handle partial writes by advancing the buffer pointer and adjusting
the remaining size on each retry.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
This commit is contained in:
fangpeina 2025-12-25 01:04:40 +08:00 committed by Xiang Xiao
parent 19dcc896d7
commit 715da6bde6

View file

@ -98,7 +98,7 @@ static int ymodem_send_buffer(FAR struct ymodem_ctx_s *ctx,
ymodem_debug("send buffer data, write size is %zu\n", size);
while (i < size)
{
ssize_t ret = write(ctx->sendfd, buf, size);
ssize_t ret = write(ctx->sendfd, buf + i, size - i);
if (ret >= 0)
{
ymodem_debug("send buffer data, size %zd\n", ret);