From ddcb5b46e26b7f8ea2c984a8b94caf084541b882 Mon Sep 17 00:00:00 2001 From: Ziyan Date: Wed, 24 Feb 2016 21:03:01 +0100 Subject: libsensors: more robust sensor polling Change-Id: I88efed34927c6911647084a3de6b61630468857f --- libsensors/piranha_sensors.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libsensors/piranha_sensors.c b/libsensors/piranha_sensors.c index eec9d68..c40f793 100644 --- a/libsensors/piranha_sensors.c +++ b/libsensors/piranha_sensors.c @@ -179,9 +179,13 @@ int piranha_sensors_poll(struct sensors_poll_device_t *dev, n = 0; do { - poll_rc = poll(device->poll_fds, device->poll_fds_count, n > 0 ? 0 : -1); - if (poll_rc < 0) - return -1; + do { + poll_rc = poll(device->poll_fds, device->poll_fds_count, n > 0 ? 0 : -1); + } while (poll_rc < 0 && errno == EINTR); + if (poll_rc < 0) { + ALOGE("poll() failed (%s)", strerror(errno)); + return -errno; + } for (i = 0; i < device->poll_fds_count; i++) { if (!(device->poll_fds[i].revents & POLLIN)) -- cgit v1.1