From dae0195380686dbec450e298f4acf47b5f9576e6 Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Wed, 10 Apr 2019 12:01:34 +0900 Subject: [PATCH] Make the SocketListener control pipe O_CLOEXEC. Children of processes that use SocketListener should not be able to stop the SocketListener. Test: builds, boots Test: atest libsysutils_tests Test: atest --test-mapping system/netd Change-Id: I64898d9966f62004468b8e8a43b59be4a81a8cc4 --- libsysutils/src/SocketListener.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsysutils/src/SocketListener.cpp b/libsysutils/src/SocketListener.cpp index ded5adb6d..97806068e 100644 --- a/libsysutils/src/SocketListener.cpp +++ b/libsysutils/src/SocketListener.cpp @@ -95,7 +95,7 @@ int SocketListener::startListener(int backlog) { } else if (!mListen) mClients[mSock] = new SocketClient(mSock, false, mUseCmdNum); - if (pipe(mCtrlPipe)) { + if (pipe2(mCtrlPipe, O_CLOEXEC)) { SLOGE("pipe failed (%s)", strerror(errno)); return -1; }