summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/DummyNetwork.cpp1
-rw-r--r--server/TetherController.cpp15
2 files changed, 15 insertions, 1 deletions
diff --git a/server/DummyNetwork.cpp b/server/DummyNetwork.cpp
index ff2cb412..a3b3435d 100644
--- a/server/DummyNetwork.cpp
+++ b/server/DummyNetwork.cpp
@@ -20,6 +20,7 @@
#define LOG_TAG "Netd"
#include "log/log.h"
+#include "errno.h"
const char* DummyNetwork::INTERFACE_NAME = "dummy0";
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index 5a08ed21..6bb9fde7 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -44,7 +44,20 @@ static const char IPV4_FORWARDING_PROC_FILE[] = "/proc/sys/net/ipv4/ip_forward";
static const char IPV6_FORWARDING_PROC_FILE[] = "/proc/sys/net/ipv6/conf/all/forwarding";
bool writeToFile(const char* filename, const char* value) {
- return WriteStringToFile(value, file);
+ int fd = open(filename, O_WRONLY);
+ if (fd < 0) {
+ ALOGE("Failed to open %s: %s", filename, strerror(errno));
+ return false;
+ }
+
+ const ssize_t len = strlen(value);
+ if (write(fd, value, len) != len) {
+ ALOGE("Failed to write %s to %s: %s", value, filename, strerror(errno));
+ close(fd);
+ return false;
+ }
+ close(fd);
+ return true;
}
bool inBpToolsMode() {