summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorAmir Goldstein <amir@cellrox.com>2013-11-10 15:36:58 +0200
committerAmir Goldstein <amir@cellrox.com>2013-11-17 14:50:00 +0200
commit1d4e86c44589b3a97ca0113493c2e569c3aabcc6 (patch)
treece947021ff8384f56934d88e7ba3e3d65cd3c6f9 /init
parent3fa14a53e70cd55df031646fe3735a6fde37deb8 (diff)
downloadsystem_core-1d4e86c44589b3a97ca0113493c2e569c3aabcc6.zip
system_core-1d4e86c44589b3a97ca0113493c2e569c3aabcc6.tar.gz
system_core-1d4e86c44589b3a97ca0113493c2e569c3aabcc6.tar.bz2
ueventd: fix a busy loop while reading uevents
Under certain conditions, poll() may raise the POLLERR flag along with POLLIN, in which case the check for (ufd.revents == POLLIN) results in an endless busy loop. The following fix was applied to hardware/libhardware_legacy/uevent/uevent.c to fix a similar bug: commit 3aabb260ceef10377c31c9e45fb239247f5cfeba Author: Mathias Agopian <mathias@google.com> Date: Mon Oct 1 14:53:18 2012 -0700 fix a typo in uevent_next_eventi Bug: 7114973 Change-Id: I15a4c714b59aeb1d02db00517d70b5f0e5ab22c2 Applying the same fix for two more poll loops in init and ueventd. Change-Id: I50693f6d3c904992ac4b8a9a14a83c7106e6b9e0
Diffstat (limited to 'init')
-rw-r--r--init/init.c2
-rw-r--r--init/ueventd.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/init/init.c b/init/init.c
index 525b69f..c497d78 100644
--- a/init/init.c
+++ b/init/init.c
@@ -1044,7 +1044,7 @@ int main(int argc, char **argv)
continue;
for (i = 0; i < fd_count; i++) {
- if (ufds[i].revents == POLLIN) {
+ if (ufds[i].revents & POLLIN) {
if (ufds[i].fd == get_property_set_fd())
handle_property_set_fd();
else if (ufds[i].fd == get_keychord_fd())
diff --git a/init/ueventd.c b/init/ueventd.c
index a41c31e..3d01836 100644
--- a/init/ueventd.c
+++ b/init/ueventd.c
@@ -94,7 +94,7 @@ int ueventd_main(int argc, char **argv)
nr = poll(&ufd, 1, -1);
if (nr <= 0)
continue;
- if (ufd.revents == POLLIN)
+ if (ufd.revents & POLLIN)
handle_device_fd();
}
}