From 794669c9ea00f4fc14a14899bcd2c9ea518c1a69 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 5 Dec 2016 18:16:47 +0100 Subject: [PATCH] trace: use the cloned environment pointer Fixes an issue where it would overwrite the first environment variable with the preload one Signed-off-by: Felix Fietkau --- trace/trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trace/trace.c b/trace/trace.c index 662010e..fdffaba 100644 --- a/trace/trace.c +++ b/trace/trace.c @@ -187,9 +187,9 @@ int main(int argc, char **argv, char **envp) _envp = calloc(envc, sizeof(char *)); memcpy(&_envp[1], _envp, envc * sizeof(char *)); - *envp = preload; + *_envp = preload; - ret = execve(_argv[0], _argv, envp); + ret = execve(_argv[0], _argv, _envp); ERROR("failed to exec %s: %s\n", _argv[0], strerror(errno)); free(_argv); -- 2.25.1