mercury-api-0.1.0.0: cbits/api/patches/eintr.patch
diff --git a/serial_transport_posix.c b/serial_transport_posix.c
index 9146589..4127ee3 100644
--- a/serial_transport_posix.c
+++ b/serial_transport_posix.c
@@ -127,12 +127,19 @@ s_receiveBytes(TMR_SR_SerialTransport *this, uint32_t length,
do
{
- FD_ZERO(&set);
- FD_SET(c->handle, &set);
- tv.tv_sec = timeoutMs / 1000;
- tv.tv_usec = (timeoutMs % 1000) * 1000;
- /* Ideally should reset this timeout value every time through */
- ret = select(c->handle + 1, &set, NULL, NULL, &tv);
+ do
+ {
+ FD_ZERO(&set);
+ FD_SET(c->handle, &set);
+ tv.tv_sec = timeoutMs / 1000;
+ tv.tv_usec = (timeoutMs % 1000) * 1000;
+ /* Ideally should reset this timeout value every time through */
+ ret = select(c->handle + 1, &set, NULL, NULL, &tv);
+ } while (ret == -1 && errno == EINTR);
+ if (ret == -1)
+ {
+ return TMR_ERROR_COMM_ERRNO(errno);
+ }
if (ret < 1)
{
return TMR_ERROR_TIMEOUT;