Fix Android env var collection

RD uses getprop to emulate geting env vars configured from the host, and it uses Process::LaunchProcess to do this that in turn uses fork/execve to launch getprop.  But execve doesn't use the env's shell lookup mechanism for exes - this resulted in the getprop call failing and the capture options using default values.

This fix is to switch to using execvpe.
This commit is contained in:
Cam Mannett
2024-08-05 17:21:03 +01:00
committed by Baldur Karlsson
parent 278aeb1c32
commit d78adf7e99
+4 -2
View File
@@ -59,12 +59,14 @@ void ResumeProcess(pid_t childPid, uint32_t delay = 0);
#define PRELOAD_ENV_VAR "DYLD_INSERT_LIBRARIES"
#define LIB_PATH_ENV_VAR "DYLD_LIBRARY_PATH"
#define LIB_SUFFIX ".dylib"
#define RD_EXECVPE execve
#else
#define PRELOAD_ENV_VAR "LD_PRELOAD"
#define LIB_PATH_ENV_VAR "LD_LIBRARY_PATH"
#define LIB_SUFFIX ".so"
#define RD_EXECVPE execvpe
#endif
@@ -626,8 +628,8 @@ static pid_t RunProcess(rdcstr appName, rdcstr workDir, const rdcstr &cmdLine, c
}
chdir(workDir.c_str());
execve(appPath.c_str(), argv, envp);
fprintf(stderr, "exec failed\n");
RD_EXECVPE(appPath.c_str(), argv, envp);
fprintf(stderr, "exec failed %s\n", strerror(errno));
_exit(1);
}
else