From d78adf7e99f1b5a5dab206ced8327325fe8eddbf Mon Sep 17 00:00:00 2001 From: Cam Mannett Date: Mon, 5 Aug 2024 17:00:59 +0100 Subject: [PATCH] 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. --- renderdoc/os/posix/posix_process.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/renderdoc/os/posix/posix_process.cpp b/renderdoc/os/posix/posix_process.cpp index 21716d80f..1adefb0d8 100644 --- a/renderdoc/os/posix/posix_process.cpp +++ b/renderdoc/os/posix/posix_process.cpp @@ -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