mirror of
https://github.com/simh/simh.git
synced 2026-04-26 03:57:11 +00:00
Fixed sim_write_serial to return 0 when the non blocking write fails with the expected errno of EAGAIN
This commit is contained in:
11
sim_serial.c
11
sim_serial.c
@@ -205,7 +205,11 @@ for (i=0; i<serial_open_device_count; ++i)
|
|||||||
|
|
||||||
static void sim_error_serial (char *routine, int error)
|
static void sim_error_serial (char *routine, int error)
|
||||||
{
|
{
|
||||||
|
extern FILE *sim_debug;
|
||||||
|
|
||||||
fprintf (stderr, "Serial: %s fails with error %d\n", routine, error);
|
fprintf (stderr, "Serial: %s fails with error %d\n", routine, error);
|
||||||
|
if (sim_debug)
|
||||||
|
fprintf (sim_debug, "Serial: %s fails with error %d\n", routine, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1244,8 +1248,11 @@ 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) && (errno != EAGAIN)) /* write error? */
|
if (written == -1)
|
||||||
sim_error_serial ("write", errno); /* report unexpected error */
|
if (errno != EAGAIN) /* unexpected error? */
|
||||||
|
sim_error_serial ("write", errno); /* report it */
|
||||||
|
else
|
||||||
|
written = 0; /* not an error, but nothing written */
|
||||||
|
|
||||||
return (int32) written; /* return number of characters written */
|
return (int32) written; /* return number of characters written */
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user