Skip to content

Conversation

@metan-ucw
Copy link
Member

When we are doing file transfer we can easily saturate the serial connection or pipe we write into and get EAGAIN.

The original code just ignored all write errors, which caused lost bytes and broken communication with kirk.

This commit fixes two bugs in the retry loop:

  • properly adjust the buffer position on subsequent write attempts
  • do a short sleep on EAGAIN and retry later on

We also print message into stderr when write() failed for any other reason than EAGAIN so that there is at least some hint of a failure in that case.

When we are doing file transfer we can easily saturate the serial
connection or pipe we write into and get EAGAIN.

The original code just ignored all write errors, which caused lost bytes
and broken communication with kirk.

This commit fixes two bugs in the retry loop:

- properly adjust the buffer position on subsequent write attempts
- do a short sleep on EAGAIN and retry later on

We also print message into stderr when write() failed for any other
reason than EAGAIN so that there is at least some hint of a failure in
that case.

Signed-off-by: Cyril Hrubis <metan@ucw.cz>
@acerv acerv self-assigned this Aug 13, 2025
@acerv acerv added the bug Something isn't working label Aug 13, 2025
@acerv acerv merged commit 4e44270 into linux-test-project:master Aug 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants