diff --git a/src/main.c b/src/main.c index 6f2bd0a..94b80fc 100644 --- a/src/main.c +++ b/src/main.c @@ -138,6 +138,9 @@ void read_can(Tel *t, int soc) { void read_uart(Tel *t, int fd, SerialParser *uart_str) { char buf[128]; int n = read(fd, buf, sizeof(buf)); + + if (n < 0) return; // -1 EAGAIN means empty + if (n > 0) { for (int i = 0; i < n; i++) { char c = buf[i];