summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-09-20 15:51:37 -0700
committerandroid code review <noreply-gerritcodereview@google.com>2012-09-20 15:51:37 -0700
commite0232039e0a59f7ef4fc67dad178387b2d5fffba (patch)
treee24e39071b09a8f339806640436919280f7261e6
parent20eade73390ac941b9ebbe19177393e70531db8b (diff)
parent24ffafedc87d05611703deb62e25d71684e0723e (diff)
downloadhardware_libhardware_legacy-e0232039e0a59f7ef4fc67dad178387b2d5fffba.zip
hardware_libhardware_legacy-e0232039e0a59f7ef4fc67dad178387b2d5fffba.tar.gz
hardware_libhardware_legacy-e0232039e0a59f7ef4fc67dad178387b2d5fffba.tar.bz2
Merge "Restore the ability to use ctrl_interface directory"
-rw-r--r--wifi/wifi.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/wifi/wifi.c b/wifi/wifi.c
index 5a42e2d..cd9bf65 100644
--- a/wifi/wifi.c
+++ b/wifi/wifi.c
@@ -367,7 +367,19 @@ int update_ctrl_interface(const char *config_file) {
} else {
strcpy(ifc, CONTROL_IFACE_PATH);
}
- if ((sptr = strstr(pbuf, "ctrl_interface="))) {
+ /*
+ * if there is a "ctrl_interface=<value>" entry, re-write it ONLY if it is
+ * NOT a directory. The non-directory value option is an Android add-on
+ * that allows the control interface to be exchanged through an environment
+ * variable (initialized by the "init" program when it starts a service
+ * with a "socket" option).
+ *
+ * The <value> is deemed to be a directory if the "DIR=" form is used or
+ * the value begins with "/".
+ */
+ if ((sptr = strstr(pbuf, "ctrl_interface=")) &&
+ (!strstr(pbuf, "ctrl_interface=DIR=")) &&
+ (!strstr(pbuf, "ctrl_interface=/"))) {
char *iptr = sptr + strlen("ctrl_interface=");
int ilen = 0;
int mlen = strlen(ifc);