light-speed-io icon indicating copy to clipboard operation
light-speed-io copied to clipboard

Handle case when `read` actually reads less data than the user requested

Open JackKelly opened this issue 5 months ago • 0 comments

The manual for read says:

On success, the number of bytes read is returned (zero indicates end of file), and the file position is advanced by this number. It is not an error if this number is smaller than the number of bytes requested; this may happen for example because fewer bytes are actually available right now (maybe because we were close to end-of-file, or because we are reading from a pipe, or from a terminal), or because read() was interrupted by a signal. See also NOTES.

I guess we submit a new read operation, to get the remaining bytes? But don't retry forever!

Related

  • #97
  • #99

JackKelly avatar Mar 12 '24 19:03 JackKelly