When checking how many bytes were written, place the constant to the left of the equality check to match the rest of the code (this avoids accidental assignment if one equals sign is accidentally written instead of two), and write the appropriate debug message depending on whether the write was interrupted or it was empty.

This commit is contained in:
Andrew Wood
2024-07-16 21:54:13 +01:00
parent c7104f0c0d
commit 8c0e3e9dad
+6 -2
View File
@@ -798,8 +798,12 @@ static int pv__transfer_write(pvstate_t state, bool *eof_in, bool *eof_out, long
* returned 0 (not an error), just wait a bit and then return zero,
* since this was a transient error.
*/
if ((nwritten == 0) || (EINTR == errno) || (EAGAIN == errno)) {
debug("%s: %s", "transient write error - waiting briefly", strerror(errno));
if ((0 == nwritten) || (EINTR == errno) || (EAGAIN == errno)) {
if (0 == nwritten) {
debug("%s", "write returned zero - waiting briefly", strerror(errno));
} else {
debug("%s: %s", "transient write error - waiting briefly", strerror(errno));
}
(void) is_data_ready(-1, NULL, -1, NULL, 10000);
return 0;
}