Merge "More O_CLOEXEC"
am: 43e4260831

* commit '43e4260831cc3d0d96c05fe18a8cad3018b5795f':
  More O_CLOEXEC
diff --git a/ProcessState.cpp b/ProcessState.cpp
index 821ab6c..33fe26c 100644
--- a/ProcessState.cpp
+++ b/ProcessState.cpp
@@ -310,9 +310,8 @@
 
 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/tests/binderDriverInterfaceTest.cpp b/tests/binderDriverInterfaceTest.cpp
index 315f349..0277550 100644
--- a/tests/binderDriverInterfaceTest.cpp
+++ b/tests/binderDriverInterfaceTest.cpp
@@ -34,7 +34,7 @@
             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);