diff --git a/ipc/ril/Ril.cpp b/ipc/ril/Ril.cpp index c6407c13d92..34e34fd9daa 100644 --- a/ipc/ril/Ril.cpp +++ b/ipc/ril/Ril.cpp @@ -278,6 +278,15 @@ RilClient::OnFileCanReadWithoutBlocking(int fd) mIncoming = new RilRawData(); ssize_t ret = read(fd, mIncoming->mData, RilRawData::MAX_DATA_SIZE); if (ret <= 0) { + if (ret == -1) { + if (errno == EINTR) { + continue; // retry system call when interrupted + } + else if (errno == EAGAIN || errno == EWOULDBLOCK) { + return; // no data available: return and re-poll + } + // else fall through to error handling on other errno's + } LOG("Cannot read from network, error %d\n", ret); // At this point, assume that we can't actually access // the socket anymore, and start a reconnect loop.