Merge "Clean up CLOEXEC in SocketListener."

This commit is contained in:
Elliott Hughes 2016-02-23 18:41:46 +00:00 committed by Gerrit Code Review
commit ed83cfba68

View file

@ -206,7 +206,7 @@ void SocketListener::runListener() {
do { do {
alen = sizeof(ss); alen = sizeof(ss);
c = accept(mSock, addrp, &alen); c = accept4(mSock, addrp, &alen, SOCK_CLOEXEC);
SLOGV("%s got %d from accept", mSocketName, c); SLOGV("%s got %d from accept", mSocketName, c);
} while (c < 0 && errno == EINTR); } while (c < 0 && errno == EINTR);
if (c < 0) { if (c < 0) {
@ -214,7 +214,6 @@ void SocketListener::runListener() {
sleep(1); sleep(1);
continue; continue;
} }
fcntl(c, F_SETFD, FD_CLOEXEC);
pthread_mutex_lock(&mClientsLock); pthread_mutex_lock(&mClientsLock);
mClients->push_back(new SocketClient(c, true, mUseCmdNum)); mClients->push_back(new SocketClient(c, true, mUseCmdNum));
pthread_mutex_unlock(&mClientsLock); pthread_mutex_unlock(&mClientsLock);