mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 14:05:18 +00:00
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.
This commit is contained in:
parent
c06b623c53
commit
d077fbc221
@ -468,22 +468,17 @@ virNetDevBridgeCreate(const char *brname)
|
|||||||
if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
|
if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
|
||||||
goto malformed_resp;
|
goto malformed_resp;
|
||||||
|
|
||||||
switch (err->error) {
|
if (err->error < 0) {
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
case -EOPNOTSUPP:
|
|
||||||
# if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR)
|
# if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR)
|
||||||
/* fallback to ioctl if netlink doesn't support creating
|
if (err->error == -EOPNOTSUPP) {
|
||||||
* bridges
|
/* fallback to ioctl if netlink doesn't support creating
|
||||||
*/
|
* bridges
|
||||||
rc = virNetDevBridgeCreateWithIoctl(brname);
|
*/
|
||||||
goto cleanup;
|
rc = virNetDevBridgeCreateWithIoctl(brname);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
# endif
|
# endif
|
||||||
/* intentionally fall through if virNetDevBridgeCreateWithIoctl()
|
|
||||||
* isn't available.
|
|
||||||
*/
|
|
||||||
ATTRIBUTE_FALLTHROUGH;
|
|
||||||
default:
|
|
||||||
virReportSystemError(-err->error,
|
virReportSystemError(-err->error,
|
||||||
_("error creating bridge interface %s"),
|
_("error creating bridge interface %s"),
|
||||||
brname);
|
brname);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user