On Tue, Jan 28, 2025 at 12:15:30AM +0100, Stefano
Brivio wrote:
These are symmetric to write_remainder() and
write_all_buf() and
almost a copy and paste of them, with the most notable differences
being reversed reads/writes and a couple of better-safe-than-sorry
asserts to keep Coverity happy.
So, there's one thing that needs to be not quite symmetric for the
read() version: we need to handle EOF. At present, I believe these
will enter an infinite loop on EOF, which is not a graceful failure
mode.
It doesn't happen in our current usage where we close the socket once
we're done, but sure, if we use it for something else, boom. Let me add
a rc == 0 case (which gets EIO or EINVAL, I'm not sure yet).
Or feel free to re-post this if you have clearer ideas how to fix this
up (but only if tested).
--
Stefano