aboutsummaryrefslogtreecommitdiff
path: root/src/common/spawn.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-10-16 18:08:36 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-10-17 09:31:34 +0000
commitc77439298591792601f8c3f4c94950ef6e2c542a (patch)
treeaf4aa7da9819246934bf30677c590ad55985de30 /src/common/spawn.cpp
parentMerge pull request #4610 (diff)
downloadmonero-c77439298591792601f8c3f4c94950ef6e2c542a.tar.xz
spawn: close all file descriptors before execve
No need to give whatever we're calling access to what we use
Diffstat (limited to 'src/common/spawn.cpp')
-rw-r--r--src/common/spawn.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/spawn.cpp b/src/common/spawn.cpp
index 59f11675c..0a2ce8387 100644
--- a/src/common/spawn.cpp
+++ b/src/common/spawn.cpp
@@ -38,6 +38,7 @@
#endif
#include "misc_log_ex.h"
+#include "util.h"
#include "spawn.h"
namespace tools
@@ -101,6 +102,8 @@ int spawn(const char *filename, const std::vector<std::string>& args, bool wait)
// child
if (pid == 0)
{
+ tools::closefrom(3);
+ close(0);
char *envp[] = {NULL};
execve(filename, argv, envp);
MERROR("Failed to execve: " << strerror(errno));