aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishal Mahaveer <a0271468@ti.com>2011-10-13 16:51:33 -0600
committerKeith Deacon <kdeacon@ti.com>2011-11-15 20:45:49 -0600
commit43e1bbb721e9c5635d6b3260f8343f455218f712 (patch)
tree1bfcc00cfdc583bb8d6742ba9a894e9ebe8113e5
parentb37682f5284e8761542445c175875e2bf8f80a1a (diff)
downloadandroid_external_wpa_supplicant_8-43e1bbb721e9c5635d6b3260f8343f455218f712.tar.gz
android_external_wpa_supplicant_8-43e1bbb721e9c5635d6b3260f8343f455218f712.tar.bz2
android_external_wpa_supplicant_8-43e1bbb721e9c5635d6b3260f8343f455218f712.zip
wpa_supplicant_8 - hostapd: Fix hostapd_cli for Android
Changes for enabling use of hostapd_cli in Android. Similar to changes in wpa_cli. Usage: hostapd_cli -i<ifname> Change-Id: I04796f09a9585bcb66bb253d3b1337d4c0587e01 Signed-off-by: Vishal Mahaveer <a0271468@ti.com>
-rw-r--r--hostapd/hostapd_cli.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index a48d7732..9de98ba0 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -143,17 +143,31 @@ static void usage(void)
static struct wpa_ctrl * hostapd_cli_open_connection(const char *ifname)
{
- char *cfile;
+ char *cfile = NULL;
int flen;
if (ifname == NULL)
return NULL;
+#ifdef ANDROID
+ if (access(ctrl_iface_dir, F_OK) < 0) {
+ cfile = os_strdup(ifname);
+ if (cfile == NULL)
+ return NULL;
+ } else {
+ flen = strlen(ctrl_iface_dir) + strlen(ifname) + 2;
+ cfile = malloc(flen);
+ if (cfile == NULL)
+ return NULL;
+ snprintf(cfile, flen, "%s/%s", ctrl_iface_dir, ifname);
+ }
+#else
flen = strlen(ctrl_iface_dir) + strlen(ifname) + 2;
cfile = malloc(flen);
if (cfile == NULL)
return NULL;
snprintf(cfile, flen, "%s/%s", ctrl_iface_dir, ifname);
+#endif /* ANDROID */
ctrl_conn = wpa_ctrl_open(cfile);
free(cfile);