perf subcmd: Set environment variable "PREFIX"
authorLeo Yan <leo.yan@linaro.org>
Sun, 25 Sep 2022 02:58:34 +0000 (10:58 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 4 Oct 2022 11:55:23 +0000 (08:55 -0300)
Set environment variable "PREFIX", it will be used by invoked shell
script, e.g. the shell script uses it to find lib paths.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220925025835.70364-2-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/subcmd/exec-cmd.c

index 33e94fb8398677e41c95b0fc2c59a5e5326c52c8..5dbea456973e1e21fb59c09874e8fb1623d31719 100644 (file)
@@ -24,6 +24,9 @@ void exec_cmd_init(const char *exec_name, const char *prefix,
        subcmd_config.prefix            = prefix;
        subcmd_config.exec_path         = exec_path;
        subcmd_config.exec_path_env     = exec_path_env;
+
+       /* Setup environment variable for invoked shell script. */
+       setenv("PREFIX", prefix, 1);
 }
 
 #define is_dir_sep(c) ((c) == '/')