[PATCH] wpa_cli: Add Android socket support

Jouni Malinen j at w1.fi
Tue Mar 15 09:29:41 EDT 2011


On Tue, Mar 08, 2011 at 02:43:24PM -0800, Dmitry Shmidt wrote:
> @@ -90,7 +93,11 @@ static int wpa_cli_quit = 0;
> +#ifdef ANDROID
> +static const char *ctrl_iface_dir = "/data/system/wpa_supplicant";
> +#else
>  static const char *ctrl_iface_dir = "/var/run/wpa_supplicant";
> +#endif

I did this using a build time option to make the change more generic for
the same reasons as this was done in wpa_ctrl.c. In addition, the
directory could be overridden with -p command line argument.

> @@ -165,6 +172,11 @@ static int wpa_cli_open_connection(const char
> +#ifdef ANDROID
> +	if (access(ctrl_iface_dir, F_OK) < 0)
> +		cfile = (char *)ifname;
> +	else {
> +#endif

It was cleaner to just use os_strdup() here to avoid typecast to get rid
of const and a special case for os_free()..

-- 
Jouni Malinen                                            PGP id EFC895FA


More information about the HostAP mailing list