aboutsummaryrefslogtreecommitdiff
path: root/net/tap.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-04-28 11:29:02 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-04-28 11:29:03 +0100
commitd09a18d44d5bc0db10caa97cdd22c70e65adfe01 (patch)
tree59888b3319b92c7a8c9c3362c01b0404457b9489 /net/tap.c
parent4a39cbb034cffd19fb4e42bf3b25f47ca30e2826 (diff)
parent9083da1d4c9dfff30d411f8c73ea494e9d78de1b (diff)
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
Net patches # gpg: Signature made Fri 25 Apr 2014 15:07:31 BST using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/net-pull-request: net: Don't use error_is_set() to suppress additional errors net: Make qmp_query_rx_filter() with name argument more obvious net: xilinx_axienet.c: Add phy soft reset bit clearing net/net.c: Remove unnecessary semicolon pcnet: remove duplicate assignment tap: Avoid extra iterations while closing file fd Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'net/tap.c')
-rw-r--r--net/tap.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/net/tap.c b/net/tap.c
index 8847ce100a..fc1b865e08 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -367,11 +367,8 @@ static int launch_script(const char *setup_script, const char *ifname, int fd)
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) {
+ for (i = 3; i < open_max; i++) {
+ if (i != fd) {
close(i);
}
}
@@ -452,11 +449,8 @@ static int net_bridge_run_helper(const char *helper, const char *bridge)
char br_buf[6+IFNAMSIZ] = {0};
char helper_cmd[PATH_MAX + sizeof(fd_buf) + sizeof(br_buf) + 15];
- for (i = 0; i < open_max; i++) {
- if (i != STDIN_FILENO &&
- i != STDOUT_FILENO &&
- i != STDERR_FILENO &&
- i != sv[1]) {
+ for (i = 3; i < open_max; i++) {
+ if (i != sv[1]) {
close(i);
}
}