Only mangle argv[0] of the first executed process and leave the argument
vector of subsequent invocations as-is to allow child programs to properly
discover resources relative to their binary locations.
Fixes "cc1" discovery when executing the host gcc through the bundled
"ccache" executable.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit
9e64874fb2508e49e52898c238d817bd152bf2c2)
int mangle_arg0(int argc, char **argv, char **env) {
char *arg0 = getenv("RUNAS_ARG0");
int mangle_arg0(int argc, char **argv, char **env) {
char *arg0 = getenv("RUNAS_ARG0");
+ unsetenv("RUNAS_ARG0");
+ }