提交 9083da1d 编写于 作者: M Markus Armbruster 提交者: Stefan Hajnoczi

net: Don't use error_is_set() to suppress additional errors

Using error_is_set(errp) that way can sweep programming errors under
the carpet when we get called incorrectly with an error set.

qmp_query_rx_filter() breaks its loop when it detects an error.  It
needs to set another error when the loop completes normally.

Return right away instead of merely breaking the loop.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 638fb141
...@@ -1045,7 +1045,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, ...@@ -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 (nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC) {
if (has_name) { if (has_name) {
error_setg(errp, "net client(%s) isn't a NIC", name); error_setg(errp, "net client(%s) isn't a NIC", name);
break; return NULL;
} }
continue; continue;
} }
...@@ -1064,7 +1064,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, ...@@ -1064,7 +1064,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name,
} else if (has_name) { } else if (has_name) {
error_setg(errp, "net client(%s) doesn't support" error_setg(errp, "net client(%s) doesn't support"
" rx-filter querying", name); " rx-filter querying", name);
break; return NULL;
} }
if (has_name) { if (has_name) {
...@@ -1072,7 +1072,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, ...@@ -1072,7 +1072,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name,
} }
} }
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); error_setg(errp, "invalid net client name: %s", name);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册