diff options
author | Miguel de Icaza <miguel@gnome.org> | 2007-01-23 18:19:58 +0300 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2007-01-23 18:19:58 +0300 |
commit | 9cd6a45e87399d51063ed0084809bca2f5963193 (patch) | |
tree | 068e6e1259f3d73b82bf606baf216e84a9088343 | |
parent | bd11c8343c3243e0fcddcdd4edcd58dfa1eb3842 (diff) |
2007-01-23 Miguel de Icaza <miguel@novell.com>
* serial.c (poll_serial): Fix for #79073, based on the patch by
Leszek Ciesielski, without introducing a GNU libc-ism.
(write_serial): Handle EINTR here as well.
svn path=/trunk/mono/; revision=71514
-rw-r--r-- | support/ChangeLog | 6 | ||||
-rw-r--r-- | support/serial.c | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/support/ChangeLog b/support/ChangeLog index 10097e6b8a4..c2591852c3c 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,9 @@ +2007-01-23 Miguel de Icaza <miguel@novell.com> + + * serial.c (poll_serial): Fix for #79073, based on the patch by + Leszek Ciesielski, without introducing a GNU libc-ism. + (write_serial): Handle EINTR here as well. + 2006-11-30 Jonathan Pryor <jonpryor@vt.edu> * map.c: _cnm_return_val_if_overflow() should be a no-op unless DEBUG is diff --git a/support/serial.c b/support/serial.c index 34d3943142d..f7746c41a86 100644 --- a/support/serial.c +++ b/support/serial.c @@ -103,7 +103,9 @@ write_serial (int fd, guchar *buffer, int offset, int count, int timeout) ufd.fd = fd; ufd.events = POLLHUP | POLLOUT | POLLERR; - poll (&ufd, 1, timeout); + while (poll (&ufd, 1, timeout) == -1 && errno == EINTR){ + + } if ((ufd.revents & POLLOUT) != POLLOUT) { return; @@ -333,12 +335,12 @@ poll_serial (int fd, gint32 *error, int timeout) pinfo.events = POLLIN; pinfo.revents = 0; - if (poll (&pinfo, 1, timeout) == -1) { + while (poll (&pinfo, 1, timeout) == -1 && errno == EINTR) { /* EINTR is an OK condition, we should not throw in the upper layer an IOException */ - if (errno == EINTR) + if (errno != EINTR){ + *error = -1; return FALSE; - *error = -1; - return FALSE; + } } return (pinfo.revents & POLLIN) != 0 ? 1 : 0; |