blob: a03fcc9f92be6a10091826f1b65035d0d333c0cb [file] [log] [blame]
developer29c4d2d2022-12-26 19:41:22 +08001--- a/src/common/wpa_ctrl.c
2+++ b/src/common/wpa_ctrl.c
3@@ -135,7 +135,7 @@ try_again:
4 return NULL;
5 }
6 tries++;
7-#ifdef ANDROID
8+
9 /* Set client socket file permissions so that bind() creates the client
10 * socket with these permissions and there is no need to try to change
11 * them with chmod() after bind() which would have potential issues with
12@@ -147,7 +147,7 @@ try_again:
13 * operations to allow the response to go through. Those are using the
14 * no-deference-symlinks version to avoid races. */
15 fchmod(ctrl->s, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
16-#endif /* ANDROID */
17+
18 if (bind(ctrl->s, (struct sockaddr *) &ctrl->local,
19 sizeof(ctrl->local)) < 0) {
20 if (errno == EADDRINUSE && tries < 2) {
21@@ -165,7 +165,11 @@ try_again:
22 return NULL;
23 }
24
25-#ifdef ANDROID
26+#ifndef ANDROID
27+ /* Set group even if we do not have privileges to change owner */
28+ lchown(ctrl->local.sun_path, -1, 101);
29+ lchown(ctrl->local.sun_path, 101, 101);
30+#else
31 /* Set group even if we do not have privileges to change owner */
32 lchown(ctrl->local.sun_path, -1, AID_WIFI);
33 lchown(ctrl->local.sun_path, AID_SYSTEM, AID_WIFI);