summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2010-12-16 16:17:29 -0800
committerIrfan Sheriff <isheriff@google.com>2010-12-17 09:39:05 -0800
commit8a5b197b3d5878e3f1cf49c9c38c090456107e87 (patch)
tree5e10dbb3269d0789bfbe1c2b514e4fa512bee78d /wifi
parente686393f88fbbdffac46578a489cd9da0d46de33 (diff)
downloadhardware_libhardware_legacy-8a5b197b3d5878e3f1cf49c9c38c090456107e87.zip
hardware_libhardware_legacy-8a5b197b3d5878e3f1cf49c9c38c090456107e87.tar.gz
hardware_libhardware_legacy-8a5b197b3d5878e3f1cf49c9c38c090456107e87.tar.bz2
rewrite wpa_supplicant.conf when it is too small
Bug: 2850497 Change-Id: Ifce2055212f78519f2cac8f73ee86b0b7a9ee0ee
Diffstat (limited to 'wifi')
-rw-r--r--wifi/wifi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/wifi/wifi.c b/wifi/wifi.c
index 6e2335c..93c1ac7 100644
--- a/wifi/wifi.c
+++ b/wifi/wifi.c
@@ -224,10 +224,14 @@ int ensure_config_file_exists()
{
char buf[2048];
int srcfd, destfd;
+ struct stat sb;
int nread;
if (access(SUPP_CONFIG_FILE, R_OK|W_OK) == 0) {
- return 0;
+ /* return if filesize is atleast 10 bytes */
+ if (stat(SUPP_CONFIG_FILE, &sb) == 0 && sb.st_size > 10) {
+ return 0;
+ }
} else if (errno != ENOENT) {
LOGE("Cannot access \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno));
return -1;