crash_handler_posix: Use execvp.
To avoid using an absolute path for the addr2line executable, use execvp
instead of execv to make the shell search for the executable in the
PATH.
Bug: angleproject:7310
Change-Id: I777e5f369011d910afffe86f8fb2372dc333a665
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3644582
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
diff --git a/util/posix/crash_handler_posix.cpp b/util/posix/crash_handler_posix.cpp
index 5587c49..76cd5e2 100644
--- a/util/posix/crash_handler_posix.cpp
+++ b/util/posix/crash_handler_posix.cpp
@@ -404,7 +404,7 @@
// Child process executes addr2line
//
// See comment in test_utils_posix.cpp::PosixProcess regarding const_cast.
- execv(commandLine[0], const_cast<char *const *>(commandLine.data()));
+ execvp(commandLine[0], const_cast<char *const *>(commandLine.data()));
std::cerr << "Error: Child process returned from exevc()" << std::endl;
_exit(EXIT_FAILURE); // exec never returns
}
@@ -461,12 +461,7 @@
// Child process executes addr2line
constexpr size_t kAddr2LineFixedParametersCount = 6;
Addr2LineCommandLine commandLineArgs = {
- "/usr/bin/addr2line", // execv requires an absolute path to find addr2line
- "-s",
- "-p",
- "-f",
- "-C",
- "-e",
+ "addr2line", "-s", "-p", "-f", "-C", "-e",
};
const char *currentModule = "";
std::string resolvedModule;