diff options
author | Dmitry Shmidt <dimitrysh@google.com> | 2010-08-09 11:04:49 -0700 |
---|---|---|
committer | Dmitry Shmidt <dimitrysh@google.com> | 2010-08-09 11:23:45 -0700 |
commit | 24bf7fc4e02b552650f299d16303eca0825dd8c8 (patch) | |
tree | 9c8183be2a5e3e4acc03b34e54858de66990abd4 /wifi | |
parent | 2bb990bfd2580f9be93a413e3a5325057977a828 (diff) | |
download | hardware_libhardware_legacy-24bf7fc4e02b552650f299d16303eca0825dd8c8.zip hardware_libhardware_legacy-24bf7fc4e02b552650f299d16303eca0825dd8c8.tar.gz hardware_libhardware_legacy-24bf7fc4e02b552650f299d16303eca0825dd8c8.tar.bz2 |
Fix wpa_supplicant.conf permissions (0660)
Change-Id: I62e6711f706af88d4447f2885f7a0ce3f30a8a2e
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/wifi.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/wifi/wifi.c b/wifi/wifi.c index e229120..4ff9350 100644 --- a/wifi/wifi.c +++ b/wifi/wifi.c @@ -239,7 +239,7 @@ int ensure_config_file_exists() return -1; } - destfd = open(SUPP_CONFIG_FILE, O_CREAT|O_WRONLY, 0660); + destfd = open(SUPP_CONFIG_FILE, O_CREAT|O_RDWR, 0660); if (destfd < 0) { close(srcfd); LOGE("Cannot create \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno)); @@ -260,6 +260,14 @@ int ensure_config_file_exists() close(destfd); close(srcfd); + /* chmod is needed because open() didn't set permisions properly */ + if (chmod(SUPP_CONFIG_FILE, 0660) < 0) { + LOGE("Error changing permissions of %s to 0660: %s", + SUPP_CONFIG_FILE, strerror(errno)); + unlink(SUPP_CONFIG_FILE); + return -1; + } + if (chown(SUPP_CONFIG_FILE, AID_SYSTEM, AID_WIFI) < 0) { LOGE("Error changing group ownership of %s to %d: %s", SUPP_CONFIG_FILE, AID_WIFI, strerror(errno)); |