From 65edda68add8cbf49770f6efdb2f11803676a9c3 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 4 Nov 2013 12:15:26 -0800 Subject: [PATCH] SERIAL: For writes to serial ports, accept both EAGAIN and EWOULDBLOCK as non-error conditions for all *nix hosts --- sim_serial.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sim_serial.c b/sim_serial.c index d9b5fdb2..9cdd78ae 100644 --- a/sim_serial.c +++ b/sim_serial.c @@ -1324,10 +1324,14 @@ int written; written = write (port, (void *) buffer, (size_t) count); /* write the buffer to the serial port */ if (written == -1) { - if (errno != EAGAIN) /* unexpected error? */ - sim_error_serial ("write", errno); /* report it */ - else + if (errno == EWOULDBLOCK) written = 0; /* not an error, but nothing written */ +#if defined(EAGAIN) + else if (errno == EAGAIN) + written = 0; /* not an error, but nothing written */ +#endif + else /* unexpected error? */ + sim_error_serial ("write", errno); /* report it */ } return (int32) written; /* return number of characters written */