From 6b435088f9dd3cdd70d2a33f4aca12ee6a3d36fd Mon Sep 17 00:00:00 2001 From: rilysh Date: Sat, 24 Feb 2024 13:59:14 +0530 Subject: [PATCH] unix_serial_passthrough.c: check errno for EWOULDBLOCK plat_serpt_write_vcon(): write() returns how much data it has written to the file descriptor, and in case an error, it returns -1. So the EWOULDBLOCK never really triggers, as in the following condition we're not checking the errno, but the return value of the write() function. --- src/unix/unix_serial_passthrough.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/unix_serial_passthrough.c b/src/unix/unix_serial_passthrough.c index d80f8a1e7..646b77d6c 100644 --- a/src/unix/unix_serial_passthrough.c +++ b/src/unix/unix_serial_passthrough.c @@ -112,7 +112,7 @@ plat_serpt_write_vcon(serial_passthrough_t *dev, uint8_t data) if (dev->mode == SERPT_MODE_HOSTSER) { do { res = write(dev->master_fd, &data, 1); - } while (res == 0 || (res == -1 && (errno == EAGAIN || res == EWOULDBLOCK))); + } while (res == 0 || (res == -1 && (errno == EAGAIN || errno == EWOULDBLOCK))); } else res = write(dev->master_fd, &data, 1); }