Commit 50d3eeae384382671952bc40e00a58f5ab00fed0
1 parent
93815bc2
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
Showing
1 changed file
with
8 additions
and
0 deletions
vl.c
| ... | ... | @@ -3621,6 +3621,14 @@ static int net_tap_init(VLANState *vlan, const char *ifname1, |
| 3621 | 3621 | pid = fork(); |
| 3622 | 3622 | if (pid >= 0) { |
| 3623 | 3623 | if (pid == 0) { |
| 3624 | + int open_max = sysconf (_SC_OPEN_MAX), i; | |
| 3625 | + for (i = 0; i < open_max; i++) | |
| 3626 | + if (i != STDIN_FILENO && | |
| 3627 | + i != STDOUT_FILENO && | |
| 3628 | + i != STDERR_FILENO && | |
| 3629 | + i != fd) | |
| 3630 | + close(i); | |
| 3631 | + | |
| 3624 | 3632 | parg = args; |
| 3625 | 3633 | *parg++ = (char *)setup_script; |
| 3626 | 3634 | *parg++ = ifname; | ... | ... |