summaryrefslogtreecommitdiffstats
path: root/libsysutils
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-02-19 18:14:22 -0800
committerElliott Hughes <enh@google.com>2016-02-19 18:14:22 -0800
commitfcd7295962270dfedbbe539a41ed554751610819 (patch)
tree9ff95f336d75e62b5bd5d9e2c020e9c7355dd1f1 /libsysutils
parentfbaefc4d9d4e7e40ec0262123cd54762b81ed47a (diff)
downloadsystem_core-fcd7295962270dfedbbe539a41ed554751610819.tar.gz
system_core-fcd7295962270dfedbbe539a41ed554751610819.tar.bz2
system_core-fcd7295962270dfedbbe539a41ed554751610819.zip
Clean up CLOEXEC in SocketListener.
Change-Id: I9811573a4b64ef2e38f1e4ba17158911b05a5f34
Diffstat (limited to 'libsysutils')
-rw-r--r--libsysutils/src/SocketListener.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/libsysutils/src/SocketListener.cpp b/libsysutils/src/SocketListener.cpp
index 168899c56..4d602a6aa 100644
--- a/libsysutils/src/SocketListener.cpp
+++ b/libsysutils/src/SocketListener.cpp
@@ -206,7 +206,7 @@ void SocketListener::runListener() {
do {
alen = sizeof(ss);
- c = accept(mSock, addrp, &alen);
+ c = accept4(mSock, addrp, &alen, SOCK_CLOEXEC);
SLOGV("%s got %d from accept", mSocketName, c);
} while (c < 0 && errno == EINTR);
if (c < 0) {
@@ -214,7 +214,6 @@ void SocketListener::runListener() {
sleep(1);
continue;
}
- fcntl(c, F_SETFD, FD_CLOEXEC);
pthread_mutex_lock(&mClientsLock);
mClients->push_back(new SocketClient(c, true, mUseCmdNum));
pthread_mutex_unlock(&mClientsLock);