The arg env of systemExe function shadows global env variable.
- Local Function : int systemExe(const std::vector<std::string>& 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.
return 0;
}
-int systemExe(const std::vector<std::string>& args, char** env) {
+int systemExe(const std::vector<std::string>& args, char** exec_env) {
bool exec_failed = false;
std::vector<const char*> argv;
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);