summaryrefslogtreecommitdiff
path: root/libwifi_system
diff options
context:
space:
mode:
authorDaisuke Niwa <daisuke.x.niwa@sonymobile.com>2017-10-05 00:53:34 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-10-05 00:53:34 +0000
commit5ab7f53cbd9fa683dc21a6d7a92608cc4cdf64e5 (patch)
tree22900057536cc80b7d4a60f73f7c7594d0dc0799 /libwifi_system
parente57b9f8e86cbbf144326dc7b86db7aca2b05609e (diff)
parentdc24ed7ffb0f1fae19b52c60ecfe9e801255e4e2 (diff)
downloadwifi-5ab7f53cbd9fa683dc21a6d7a92608cc4cdf64e5.tar.gz
Remove hostapd.conf before starting Tethering
am: dc24ed7ffb Change-Id: I06bcd9c340231fa716860577763e00c432df705a
Diffstat (limited to 'libwifi_system')
-rw-r--r--libwifi_system/hostapd_manager.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libwifi_system/hostapd_manager.cpp b/libwifi_system/hostapd_manager.cpp
index 68184e901..658eecdd8 100644
--- a/libwifi_system/hostapd_manager.cpp
+++ b/libwifi_system/hostapd_manager.cpp
@@ -34,6 +34,7 @@
using android::base::ParseInt;
using android::base::ReadFileToString;
+using android::base::RemoveFileIfExists;
using android::base::StringPrintf;
using android::base::WriteStringToFile;
using std::string;
@@ -103,6 +104,9 @@ bool HostapdManager::StopHostapd() {
}
bool HostapdManager::WriteHostapdConfig(const string& config) {
+ // Remove hostapd.conf because its file owner might be system
+ // in previous OS and chmod fails in that case.
+ RemoveFileIfExists(kHostapdConfigFilePath);
if (!WriteStringToFile(config, kHostapdConfigFilePath,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
AID_WIFI, AID_WIFI)) {