summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNingyuan Wang <nywang@google.com>2017-06-01 15:43:09 -0700
committerNingyuan Wang <nywang@google.com>2017-06-01 15:56:59 -0700
commitb0b13eab17ba781d417ad25bc7166410adbae2c6 (patch)
treeff19d6bcaf20d19ae58aa105e3d40680cb35a34e
parentaf32c06cd4eaca6492614d0c4aad69609022e030 (diff)
downloadandroid_frameworks_opt_net_wifi-b0b13eab17ba781d417ad25bc7166410adbae2c6.tar.gz
android_frameworks_opt_net_wifi-b0b13eab17ba781d417ad25bc7166410adbae2c6.tar.bz2
android_frameworks_opt_net_wifi-b0b13eab17ba781d417ad25bc7166410adbae2c6.zip
Improve logging for supplicant config file
Supplicant config could be in either /system or /vendor, we should only log error if we can't find it in both places. Bug: 62268780 Test: compile, unit tests, manual test Change-Id: I5a66ef27385aee79f3ec6fdcaafc46c8cda793d8
-rw-r--r--libwifi_system/supplicant_manager.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/libwifi_system/supplicant_manager.cpp b/libwifi_system/supplicant_manager.cpp
index d115dc1e7..28010ec8d 100644
--- a/libwifi_system/supplicant_manager.cpp
+++ b/libwifi_system/supplicant_manager.cpp
@@ -67,16 +67,22 @@ int ensure_config_file_exists(const char* config_file) {
return false;
}
- templatePath = std::string("/system") + std::string(kSupplicantConfigTemplatePath);
- srcfd = TEMP_FAILURE_RETRY(open(templatePath.c_str(), O_RDONLY));
+ std::string configPathSystem =
+ std::string("/system") + std::string(kSupplicantConfigTemplatePath);
+ std::string configPathVendor =
+ std::string("/vendor") + std::string(kSupplicantConfigTemplatePath);
+ srcfd = TEMP_FAILURE_RETRY(open(configPathSystem.c_str(), O_RDONLY));
+ templatePath = configPathSystem;
if (srcfd < 0) {
- LOG(ERROR) << "Cannot open \"" << templatePath << "\": "
- << strerror(errno);
- templatePath = std::string("/vendor") + std::string(kSupplicantConfigTemplatePath);
- srcfd = TEMP_FAILURE_RETRY(open(templatePath.c_str(), O_RDONLY));
+ int errnoSystem = errno;
+ srcfd = TEMP_FAILURE_RETRY(open(configPathVendor.c_str(), O_RDONLY));
+ templatePath = configPathVendor;
if (srcfd < 0) {
- LOG(ERROR) << "Cannot open \"" << templatePath << "\": "
- << strerror(errno);
+ int errnoVendor = errno;
+ LOG(ERROR) << "Cannot open \"" << configPathSystem << "\": "
+ << strerror(errnoSystem);
+ LOG(ERROR) << "Cannot open \"" << configPathVendor << "\": "
+ << strerror(errnoVendor);
return false;
}
}