diff options
author | Irfan Sheriff <isheriff@google.com> | 2010-12-16 16:17:29 -0800 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2010-12-17 09:39:05 -0800 |
commit | 8a5b197b3d5878e3f1cf49c9c38c090456107e87 (patch) | |
tree | 5e10dbb3269d0789bfbe1c2b514e4fa512bee78d /wifi | |
parent | e686393f88fbbdffac46578a489cd9da0d46de33 (diff) | |
download | hardware_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.c | 6 |
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; |