Skip to content

Commit

Permalink
ATRONIX: by Hostile Fork - Quietly tolerate EINTR in POSIX %dev-event.c
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
hostilefork authored and Oldes committed Nov 7, 2017
1 parent 0395c77 commit b1f2431
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/os/posix/dev-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <errno.h>

#include "reb-host.h"
#include "host-lib.h"
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit b1f2431

Please sign in to comment.