am 0fb73406: am 0cc49e8d: Add BOARD_WLAN_DEVICE=mrvl check for ANDROID_P2P support

* commit '0fb734060951ad2513680f2d9f9013ff68c2772e':
  Add BOARD_WLAN_DEVICE=mrvl check for ANDROID_P2P support
diff --git a/Android.mk b/Android.mk
index 1fd458c..76afb77 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,5 +1,8 @@
 LOCAL_PATH:= $(call my-dir)
 
+ifndef WPA_SUPPLICANT_VERSION
+WPA_SUPPLICANT_VERSION := VER_0_8_X
+endif
 ifeq ($(WPA_SUPPLICANT_VERSION),VER_0_8_X)
 # The order of the 2 Android.mks does matter!
 # TODO: Clean up the Android.mks, reset all the temporary variables at the
diff --git a/wpa_supplicant/ctrl_iface_unix.c b/wpa_supplicant/ctrl_iface_unix.c
index 80db27e..4dfabc8 100644
--- a/wpa_supplicant/ctrl_iface_unix.c
+++ b/wpa_supplicant/ctrl_iface_unix.c
@@ -329,6 +329,22 @@
 		}
 	}
 
+#ifdef ANDROID
+	/*
+	 * wpa_supplicant is started from /init.*.rc on Android and that seems
+	 * to be using umask 0077 which would leave the control interface
+	 * directory without group access. This breaks things since Wi-Fi
+	 * framework assumes that this directory can be accessed by other
+	 * applications in the wifi group. Fix this by adding group access even
+	 * if umask value would prevent this.
+	 */
+	if (chmod(dir, S_IRWXU | S_IRWXG) < 0) {
+		wpa_printf(MSG_ERROR, "CTRL: Could not chmod directory: %s",
+			   strerror(errno));
+		/* Try to continue anyway */
+	}
+#endif /* ANDROID */
+
 	if (gid_str) {
 		grp = getgrnam(gid_str);
 		if (grp) {