diff options
| author | Nick Kralevich <nnk@google.com> | 2015-02-03 22:25:02 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2015-02-03 22:25:02 +0000 |
| commit | 69766c22edb99338c3b703aeadbaa286f6b78334 (patch) | |
| tree | 7cbefe6e1f1e009ae2759ba500b4ecf94e643beb /server/TetherController.cpp | |
| parent | 623e69e66b18fb3af840369633548bbd6c098580 (diff) | |
| parent | 6c08cd6aa7aee66b973ee4861237ad36560e0239 (diff) | |
am 6c08cd6a: Merge "Avoid leaking file descriptors"
* commit '6c08cd6aa7aee66b973ee4861237ad36560e0239':
Avoid leaking file descriptors
Diffstat (limited to 'server/TetherController.cpp')
| -rw-r--r-- | server/TetherController.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/TetherController.cpp b/server/TetherController.cpp index 4e1c52f4..a91c7444 100644 --- a/server/TetherController.cpp +++ b/server/TetherController.cpp @@ -66,7 +66,7 @@ int TetherController::setIpFwdEnabled(bool enable) { return 0; } - int fd = open("/proc/sys/net/ipv4/ip_forward", O_WRONLY); + int fd = open("/proc/sys/net/ipv4/ip_forward", O_WRONLY | O_CLOEXEC); if (fd < 0) { ALOGE("Failed to open ip_forward (%s)", strerror(errno)); return -1; @@ -82,7 +82,7 @@ int TetherController::setIpFwdEnabled(bool enable) { } bool TetherController::getIpFwdEnabled() { - int fd = open("/proc/sys/net/ipv4/ip_forward", O_RDONLY); + int fd = open("/proc/sys/net/ipv4/ip_forward", O_RDONLY | O_CLOEXEC); if (fd < 0) { ALOGE("Failed to open ip_forward (%s)", strerror(errno)); |
