summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);