summaryrefslogtreecommitdiffstats
path: root/vl.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-03-19 16:36:43 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-03-19 16:36:43 +0000
commit50d3eeae384382671952bc40e00a58f5ab00fed0 (patch)
treefe47721cf7cc404c410acf2d99dc9a6c337b08b3 /vl.c
parent93815bc280744c05abab9501eeb53edd01190e1b (diff)
downloadhqemu-50d3eeae384382671952bc40e00a58f5ab00fed0.zip
hqemu-50d3eeae384382671952bc40e00a58f5ab00fed0.tar.gz
Close file descriptors when execing network tap setup script, by
Daniel P. Berrange. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2507 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index e77ed41..f368d9b 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;
OpenPOWER on IntegriCloud