diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/net.c | 8 | ||||
-rw-r--r-- | net/tap.c | 14 |
2 files changed, 10 insertions, 12 deletions
@@ -1045,7 +1045,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, if (nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC) { if (has_name) { error_setg(errp, "net client(%s) isn't a NIC", name); - break; + return NULL; } continue; } @@ -1064,11 +1064,15 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, } else if (has_name) { error_setg(errp, "net client(%s) doesn't support" " rx-filter querying", name); + return NULL; + } + + if (has_name) { break; } } - if (filter_list == NULL && !error_is_set(errp) && has_name) { + if (filter_list == NULL && has_name) { error_setg(errp, "invalid net client name: %s", name); } @@ -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); } } |