summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author Nick Kralevich <nnk@google.com> 2015-12-23 18:58:05 -0800
committer Nick Kralevich <nnk@google.com> 2015-12-23 18:58:05 -0800
commit0fe7ce375ed6c9fcd86b8bb3a836bc37c9740831 (patch)
tree102d911f13b99265e0ff5eed47dcac5ad18d11b9 /libs
parent0d77698233ffcbc812c2586693546355ce521603 (diff)
More O_CLOEXEC
Change-Id: I31991ed089f395174857e86e509b8190ad98f92a
Diffstat (limited to 'libs')
-rw-r--r--libs/binder/ProcessState.cpp3
-rw-r--r--libs/binder/tests/binderDriverInterfaceTest.cpp2
2 files changed, 2 insertions, 3 deletions
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 821ab6cb9b..33fe26cfa9 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -310,9 +310,8 @@ void ProcessState::giveThreadPoolName() {
static int open_driver()
{
- int fd = open("/dev/binder", O_RDWR);
+ int fd = open("/dev/binder", O_RDWR | O_CLOEXEC);
if (fd >= 0) {
- fcntl(fd, F_SETFD, FD_CLOEXEC);
int vers = 0;
status_t result = ioctl(fd, BINDER_VERSION, &vers);
if (result == -1) {
diff --git a/libs/binder/tests/binderDriverInterfaceTest.cpp b/libs/binder/tests/binderDriverInterfaceTest.cpp
index 315f34956c..0277550258 100644
--- a/libs/binder/tests/binderDriverInterfaceTest.cpp
+++ b/libs/binder/tests/binderDriverInterfaceTest.cpp
@@ -34,7 +34,7 @@ class BinderDriverInterfaceTestEnv : public ::testing::Environment {
int ret;
uint32_t max_threads = 0;
- m_binderFd = open(BINDER_DEV_NAME, O_RDWR | O_NONBLOCK);
+ m_binderFd = open(BINDER_DEV_NAME, O_RDWR | O_NONBLOCK | O_CLOEXEC);
ASSERT_GE(m_binderFd, 0);
m_buffer = mmap(NULL, 64*1024, PROT_READ, MAP_SHARED, m_binderFd, 0);
ASSERT_NE(m_buffer, (void *)NULL);