Give SocketListener some FD_CLOEXEC.
Sockets love FD_CLOEXEC. Bug: 19993667 Change-Id: I0d72a27e0f46b79843bb91ed48ebaf1c89484fd2
This commit is contained in:
parent
25775e8e63
commit
55fd316ea7
1 changed files with 2 additions and 0 deletions
|
|
@ -86,6 +86,7 @@ int SocketListener::startListener(int backlog) {
|
|||
return -1;
|
||||
}
|
||||
SLOGV("got mSock = %d for %s", mSock, mSocketName);
|
||||
fcntl(mSock, F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
|
||||
if (mListen && listen(mSock, backlog) < 0) {
|
||||
|
|
@ -212,6 +213,7 @@ 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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue