aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-03-17 17:56:52 +0200
committerRiccardo Spagni <ric@spagni.net>2019-03-17 17:56:52 +0200
commitc3de019f565674fd19b9d5cafba015d9ea7f69f7 (patch)
treedb6ee31b5f31cd2e1cf4b83dcd81895d24b51e5f /src/common
parentMerge pull request #5190 (diff)
parentperformance_tests: fix NetBSD build (diff)
downloadmonero-c3de019f565674fd19b9d5cafba015d9ea7f69f7.tar.xz
Merge pull request #5192
d0e07b3d performance_tests: fix NetBSD build (moneromooo-monero) 7d88d8f2 discontinue use of alloca (moneromooo-monero)
Diffstat (limited to 'src/common')
-rw-r--r--src/common/spawn.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/spawn.cpp b/src/common/spawn.cpp
index e03552f8c..9a7e75d41 100644
--- a/src/common/spawn.cpp
+++ b/src/common/spawn.cpp
@@ -91,7 +91,7 @@ int spawn(const char *filename, const std::vector<std::string>& args, bool wait)
MINFO("Child exited with " << exitCode);
return static_cast<int>(exitCode);
#else
- char **argv = (char**)alloca(sizeof(char*) * (args.size() + 1));
+ std::vector<char*> argv(args.size() + 1);
for (size_t n = 0; n < args.size(); ++n)
argv[n] = (char*)args[n].c_str();
argv[args.size()] = NULL;
@@ -109,7 +109,7 @@ int spawn(const char *filename, const std::vector<std::string>& args, bool wait)
tools::closefrom(3);
close(0);
char *envp[] = {NULL};
- execve(filename, argv, envp);
+ execve(filename, argv.data(), envp);
MERROR("Failed to execve: " << strerror(errno));
return -1;
}