From: Felix Fietkau Date: Mon, 5 Dec 2016 17:16:47 +0000 (+0100) Subject: trace: use the cloned environment pointer X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=794669c9ea00f4fc14a14899bcd2c9ea518c1a69;p=project%2Fprocd.git 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 --- 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);