From e8581183f98d5fab6ba15b405564152d7161de7d Mon Sep 17 00:00:00 2001 From: Purushottam Kushwaha Date: Fri, 12 Oct 2018 15:37:34 +0530 Subject: [PATCH] HS 2.0: Use execve() with custom env PATH to launch browser using 'am' With new restriction in Android, if PATH env variable doesn't have correct path of 'am' binary, execv() fails to launch wpadebug browser (am starts, but something seems to fail within its internal processing). This commit is a workaround to use execve() with custom environment PATH which includes "/system/bin;/vendor/bin" to handle the cases where hs20-osu-client fails to launch wpadebug browser through /system/bin/am. Signed-off-by: Jouni Malinen --- src/utils/browser-wpadebug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/browser-wpadebug.c b/src/utils/browser-wpadebug.c index 062e6fef1..dfb4b6797 100644 --- a/src/utils/browser-wpadebug.c +++ b/src/utils/browser-wpadebug.c @@ -97,6 +97,7 @@ int hs20_web_browser(const char *url) if (pid == 0) { /* run the external command in the child process */ char *argv[14]; + char *envp[] = { "PATH=/system/bin:/vendor/bin", NULL }; argv[0] = "browser-wpadebug"; argv[1] = "start"; @@ -113,8 +114,8 @@ int hs20_web_browser(const char *url) argv[12] = "-3"; /* USER_CURRENT_OR_SELF */ argv[13] = NULL; - execv("/system/bin/am", argv); - wpa_printf(MSG_ERROR, "execv: %s", strerror(errno)); + execve("/system/bin/am", argv, envp); + wpa_printf(MSG_ERROR, "execve: %s", strerror(errno)); exit(0); return -1; }