SERIAL: For writes to serial ports, accept both EAGAIN and EWOULDBLOCK as non-error conditions for all *nix hosts
This commit is contained in:
parent
53690b3a15
commit
65edda68ad
1 changed files with 7 additions and 3 deletions
10
sim_serial.c
10
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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue