SERIAL: For writes to serial ports, accept both EAGAIN and EWOULDBLOCK as non-error conditions for all *nix hosts

This commit is contained in:
Mark Pizzolato 2013-11-04 12:15:26 -08:00
parent 53690b3a15
commit 65edda68ad

View file

@ -1324,10 +1324,14 @@ int written;
written = write (port, (void *) buffer, (size_t) count); /* write the buffer to the serial port */ written = write (port, (void *) buffer, (size_t) count); /* write the buffer to the serial port */
if (written == -1) { if (written == -1) {
if (errno != EAGAIN) /* unexpected error? */ if (errno == EWOULDBLOCK)
sim_error_serial ("write", errno); /* report it */
else
written = 0; /* not an error, but nothing written */ 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 */ return (int32) written; /* return number of characters written */