Skip to content

Commit

Permalink
Merge "Clean up CLOEXEC in SocketListener."
Browse files Browse the repository at this point in the history
  • Loading branch information
enh-google authored and Gerrit Code Review committed Feb 23, 2016
2 parents f405d24 + fcd7295 commit ed83cfb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions libsysutils/src/SocketListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,14 @@ 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) {
SLOGE("accept failed (%s)", strerror(errno));
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);
Expand Down

0 comments on commit ed83cfb

Please sign in to comment.