aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index e77ed41249..f368d9bba2 100644
--- a/vl.c
+++ b/vl.c
@@ -3621,6 +3621,14 @@ static int net_tap_init(VLANState *vlan, const char *ifname1,
pid = fork();
if (pid >= 0) {
if (pid == 0) {
+ int open_max = sysconf (_SC_OPEN_MAX), i;
+ for (i = 0; i < open_max; i++)
+ if (i != STDIN_FILENO &&
+ i != STDOUT_FILENO &&
+ i != STDERR_FILENO &&
+ i != fd)
+ close(i);
+
parg = args;
*parg++ = (char *)setup_script;
*parg++ = ifname;