提交 d077fbc2 编写于 作者: P Peter Krempa

util: netdevbridge: Refactor error handling in virNetDevBridgeCreate

Replace the switch statement with a simpler if statement. This also
removes the fallthrough path that coverity was complaining about.
上级 c06b623c
......@@ -468,22 +468,17 @@ virNetDevBridgeCreate(const char *brname)
if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
goto malformed_resp;
switch (err->error) {
case 0:
break;
case -EOPNOTSUPP:
if (err->error < 0) {
# if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR)
if (err->error == -EOPNOTSUPP) {
/* fallback to ioctl if netlink doesn't support creating
* bridges
*/
rc = virNetDevBridgeCreateWithIoctl(brname);
goto cleanup;
}
# endif
/* intentionally fall through if virNetDevBridgeCreateWithIoctl()
* isn't available.
*/
ATTRIBUTE_FALLTHROUGH;
default:
virReportSystemError(-err->error,
_("error creating bridge interface %s"),
brname);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册