From 705611074673ff9487b616718e899bea0008c454 Mon Sep 17 00:00:00 2001 From: Kunhoon Baik Date: Fri, 3 Sep 2021 09:55:02 +0900 Subject: [PATCH] Fix "-Werror=shadow" Error of open source nsjail The arg env of systemExe function shadows global env variable. - Local Function : int systemExe(const std::vector& args, char** env); - Global : static __thread jmp_buf env; -Werror=shadow options catches the issue. Thus, the arg env of systemExe is changed to exec_env to avoid the compiler issue. cf) This patch is not yet contributed to nsjail open source. --- subproc.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subproc.cc b/subproc.cc index e573472..7792fbd 100644 --- a/subproc.cc +++ b/subproc.cc @@ -569,7 +569,7 @@ pid_t cloneProc(uintptr_t flags, int exit_signal) { return 0; } -int systemExe(const std::vector& args, char** env) { +int systemExe(const std::vector& args, char** exec_env) { bool exec_failed = false; std::vector argv; @@ -594,7 +594,7 @@ int systemExe(const std::vector& args, char** env) { if (pid == 0) { close(sv[0]); - execve(argv[0], (char* const*)argv.data(), (char* const*)env); + execve(argv[0], (char* const*)argv.data(), (char* const*)exec_env); PLOG_W("execve('%s')", argv[0]); util::writeToFd(sv[1], "A", 1); exit(0); -- 2.34.1