summaryrefslogtreecommitdiffstats
path: root/health
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2018-12-15 11:36:47 -0800
committerNick Kralevich <nnk@google.com>2018-12-15 11:36:47 -0800
commit8c038f2a2f7fef5950149bd10d21c5d6234806a8 (patch)
tree36b406b35d528ee2ecd1b67b822e6009f6e988fa /health
parentba400a29db31b336efab4b07c02c86c99fcb6561 (diff)
downloadandroid_hardware_interfaces-8c038f2a2f7fef5950149bd10d21c5d6234806a8.tar.gz
android_hardware_interfaces-8c038f2a2f7fef5950149bd10d21c5d6234806a8.tar.bz2
android_hardware_interfaces-8c038f2a2f7fef5950149bd10d21c5d6234806a8.zip
healthd_common.cpp: use epoll_create1
epoll_create leaks file descriptors. Use epoll_create1(EPOLL_CLOEXEC) instead. Bug: 120983106 Test: compiles and boots Change-Id: I50aad9f1c0633add2b44fb22be73dd292a366f39
Diffstat (limited to 'health')
-rw-r--r--health/2.0/default/healthd_common.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/health/2.0/default/healthd_common.cpp b/health/2.0/default/healthd_common.cpp
index 8ff409dd5..b5fdc8ecb 100644
--- a/health/2.0/default/healthd_common.cpp
+++ b/health/2.0/default/healthd_common.cpp
@@ -67,8 +67,6 @@ static int epollfd;
#define POWER_SUPPLY_SUBSYSTEM "power_supply"
-// epoll_create() parameter is actually unused
-#define MAX_EPOLL_EVENTS 40
static int uevent_fd;
static int wakealarm_fd;
@@ -240,9 +238,9 @@ static void healthd_mainloop(void) {
}
static int healthd_init() {
- epollfd = epoll_create(MAX_EPOLL_EVENTS);
+ epollfd = epoll_create1(EPOLL_CLOEXEC);
if (epollfd == -1) {
- KLOG_ERROR(LOG_TAG, "epoll_create failed; errno=%d\n", errno);
+ KLOG_ERROR(LOG_TAG, "epoll_create1 failed; errno=%d\n", errno);
return -1;
}