diff options
author | Nick Kralevich <nnk@google.com> | 2015-02-03 22:56:28 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-02-03 22:56:28 +0000 |
commit | fa18636462a4a3b32c68cd435108259fdc928687 (patch) | |
tree | e6f62f7636295130c0025a88bd85e249887b3deb /client | |
parent | f0bb70c000e6fd85c3289e957c0a66b2bed1df3c (diff) | |
parent | 69766c22edb99338c3b703aeadbaa286f6b78334 (diff) | |
download | android_system_netd-fa18636462a4a3b32c68cd435108259fdc928687.tar.gz android_system_netd-fa18636462a4a3b32c68cd435108259fdc928687.tar.bz2 android_system_netd-fa18636462a4a3b32c68cd435108259fdc928687.zip |
am 69766c22: am 6c08cd6a: Merge "Avoid leaking file descriptors"
* commit '69766c22edb99338c3b703aeadbaa286f6b78334':
Avoid leaking file descriptors
Diffstat (limited to 'client')
-rw-r--r-- | client/FwmarkClient.cpp | 2 | ||||
-rw-r--r-- | client/NetdClient.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/client/FwmarkClient.cpp b/client/FwmarkClient.cpp index 4e02d583..0ac1fbbc 100644 --- a/client/FwmarkClient.cpp +++ b/client/FwmarkClient.cpp @@ -43,7 +43,7 @@ FwmarkClient::~FwmarkClient() { } int FwmarkClient::send(void* data, size_t len, int fd) { - mChannel = socket(AF_UNIX, SOCK_STREAM, 0); + mChannel = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); if (mChannel == -1) { return -errno; } diff --git a/client/NetdClient.cpp b/client/NetdClient.cpp index 0c9d1859..3157d3a9 100644 --- a/client/NetdClient.cpp +++ b/client/NetdClient.cpp @@ -118,9 +118,9 @@ int setNetworkForTarget(unsigned netId, std::atomic_uint* target) { // might itself cause another check with the fwmark server, which would be wasteful. int socketFd; if (libcSocket) { - socketFd = libcSocket(AF_INET6, SOCK_DGRAM, 0); + socketFd = libcSocket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0); } else { - socketFd = socket(AF_INET6, SOCK_DGRAM, 0); + socketFd = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0); } if (socketFd < 0) { return -errno; |