gvanem / Watt-32

Watt-32 TCP/IP library and samples.
https://www.watt-32.net/
18 stars 8 forks source link

Return partial byte count on error in scatter/gather IO functions #101

Closed jwt27 closed 7 months ago

jwt27 commented 7 months ago

Just noticed this potential bug.

When reading or writing multiple iovecs, if an error occurs after the first one, the byte count of the previous successful operation is discarded. In the case of EWOULDBLOCK, the application will try again, and will end up sending duplicate output or discarding valid input. It is safer to return -1 only if nothing was transmitted.

gvanem commented 7 months ago

This makes sense; merged and many thanks again!