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 <jouni@codeaurora.org>
This commit is contained in:
parent
77fcd74753
commit
e8581183f9
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue