X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=support%2Fserial.c;h=34d3943142d064db85829fb41129aef88ee0092d;hb=444f1ae2c091de3ce8646fcd5be4479a46deb1d4;hp=c0d2dbdae9fab589a295a44bd69b2f93b30f7a4f;hpb=538d3bb80572334c18ae117ea7703406a4a22872;p=mono.git diff --git a/support/serial.c b/support/serial.c index c0d2dbdae9f..34d3943142d 100644 --- a/support/serial.c +++ b/support/serial.c @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -322,7 +323,7 @@ set_signal (int fd, MonoSerialSignal signal, gboolean value) } gboolean -poll_serial (int fd, gint32 *error) +poll_serial (int fd, gint32 *error, int timeout) { struct pollfd pinfo; @@ -332,7 +333,10 @@ poll_serial (int fd, gint32 *error) pinfo.events = POLLIN; pinfo.revents = 0; - if (poll (&pinfo, 1, 0) == -1) { + if (poll (&pinfo, 1, timeout) == -1) { + /* EINTR is an OK condition, we should not throw in the upper layer an IOException */ + if (errno == EINTR) + return FALSE; *error = -1; return FALSE; }