Hello,

Due to a bug in my application, the code tried to use sendfile() with zero
size.

As I see, sendfile() will happily proceed, and it will block here:
https://github.com/apache/nuttx/blob/master/net/tcp/tcp_sendfile.c#L523

Obviously, it will never manage to send any data (as the requested size is
0),
and after the timeout expires, it will return EAGAIN.

This seems a bit wrong to me.
Why not return immediately, but instead wait for the (inevitable) timeout?
Why not return a more meaningful error code, or maybe just 0?

I couldn't find what the standards dictate for this edge case, so maybe the
current behavior is correct.

What do you think?

Reply via email to