mirror of https://gitee.com/openkylin/qemu.git
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
This commit is contained in:
parent
93815bc280
commit
50d3eeae38
8
vl.c
8
vl.c
|
@ -3621,6 +3621,14 @@ static int net_tap_init(VLANState *vlan, const char *ifname1,
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid >= 0) {
|
if (pid >= 0) {
|
||||||
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 = args;
|
||||||
*parg++ = (char *)setup_script;
|
*parg++ = (char *)setup_script;
|
||||||
*parg++ = ifname;
|
*parg++ = ifname;
|
||||||
|
|
Loading…
Reference in New Issue