From b1f243185ea0cbf44bfb8af4aaea51f38a57efec Mon Sep 17 00:00:00 2001 From: Hostile Fork Date: Sat, 20 Feb 2016 01:18:27 -0500 Subject: [PATCH] ATRONIX: by Hostile Fork - Quietly tolerate EINTR in POSIX %dev-event.c Doing Ctrl-C during a timer wait would print out the string ERROR!!!! and then cancel. Since there was no particular handling of the error besides printing the message, this suppresses the message in the EINTR case (though still returns an error code). --- src/os/posix/dev-event.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/os/posix/dev-event.c b/src/os/posix/dev-event.c index 29b9eaf5ce..f910c6881e 100644 --- a/src/os/posix/dev-event.c +++ b/src/os/posix/dev-event.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "reb-host.h" #include "host-lib.h" @@ -103,8 +104,16 @@ void Done_Device(int handle, int error); result = select(0, 0, 0, 0, &tv); if (result < 0) { - // !!! set error code - printf("ERROR!!!!\n"); + // + // !!! In R3-Alpha this had a TBD that said "set error code" and had a + // printf that said "ERROR!!!!". However this can happen when a + // Ctrl-C interrupts a timer on a WAIT. As a patch this is tolerant + // of EINTR, but still returns the error code. :-/ + // + if (errno == EINTR) + return DR_ERROR; + + printf("select() returned -1 in dev-event.c (I/O error!)\n"); return DR_ERROR; }