提交 b396fae9 编写于 作者: P Pavel Hrdina

Fix issue found by coverity and cleanup

Coverity found an issue in lxc_driver and uml_driver that we don't
check the return value of register functions.

I've also updated all other places and unify the way we check the
return value.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 fbf14e82
......@@ -715,7 +715,9 @@ static virStateDriver bhyveStateDriver = {
int
bhyveRegister(void)
{
virRegisterDriver(&bhyveDriver);
virRegisterStateDriver(&bhyveStateDriver);
if (virRegisterDriver(&bhyveDriver) < 0)
return -1;
if (virRegisterStateDriver(&bhyveStateDriver) < 0)
return -1;
return 0;
}
......@@ -1194,6 +1194,7 @@ int netcfIfaceRegister(void) {
_("failed to register netcf interface driver"));
return -1;
}
virRegisterStateDriver(&interfaceStateDriver);
if (virRegisterStateDriver(&interfaceStateDriver) < 0)
return -1;
return 0;
}
......@@ -5767,7 +5767,9 @@ static virStateDriver lxcStateDriver = {
int lxcRegister(void)
{
virRegisterDriver(&lxcDriver);
virRegisterStateDriver(&lxcStateDriver);
if (virRegisterDriver(&lxcDriver) < 0)
return -1;
if (virRegisterStateDriver(&lxcStateDriver) < 0)
return -1;
return 0;
}
......@@ -3232,7 +3232,8 @@ static virStateDriver networkStateDriver = {
int networkRegister(void) {
if (virRegisterNetworkDriver(&networkDriver) < 0)
return -1;
virRegisterStateDriver(&networkStateDriver);
if (virRegisterStateDriver(&networkStateDriver) < 0)
return -1;
return 0;
}
......
......@@ -716,8 +716,11 @@ static virDomainConfNWFilterDriver domainNWFilterDriver = {
int nwfilterRegister(void) {
virRegisterNWFilterDriver(&nwfilterDriver);
virRegisterStateDriver(&stateDriver);
virDomainConfNWFilterRegister(&domainNWFilterDriver);
if (virRegisterNWFilterDriver(&nwfilterDriver) < 0)
return -1;
if (virRegisterStateDriver(&stateDriver) < 0)
return -1;
if (virDomainConfNWFilterRegister(&domainNWFilterDriver) < 0)
return -1;
return 0;
}
......@@ -16796,7 +16796,9 @@ static virStateDriver qemuStateDriver = {
};
int qemuRegister(void) {
virRegisterDriver(&qemuDriver);
virRegisterStateDriver(&qemuStateDriver);
if (virRegisterDriver(&qemuDriver) < 0)
return -1;
if (virRegisterStateDriver(&qemuStateDriver) < 0)
return -1;
return 0;
}
......@@ -7825,15 +7825,23 @@ remoteRegister(void)
{
remoteDriver = &remote_driver;
if (virRegisterDriver(&remote_driver) == -1) return -1;
if (virRegisterNetworkDriver(&network_driver) == -1) return -1;
if (virRegisterInterfaceDriver(&interface_driver) == -1) return -1;
if (virRegisterStorageDriver(&storage_driver) == -1) return -1;
if (virRegisterNodeDeviceDriver(&node_device_driver) == -1) return -1;
if (virRegisterSecretDriver(&secret_driver) == -1) return -1;
if (virRegisterNWFilterDriver(&nwfilter_driver) == -1) return -1;
if (virRegisterDriver(&remote_driver) < 0)
return -1;
if (virRegisterNetworkDriver(&network_driver) < 0)
return -1;
if (virRegisterInterfaceDriver(&interface_driver) < 0)
return -1;
if (virRegisterStorageDriver(&storage_driver) < 0)
return -1;
if (virRegisterNodeDeviceDriver(&node_device_driver) < 0)
return -1;
if (virRegisterSecretDriver(&secret_driver) < 0)
return -1;
if (virRegisterNWFilterDriver(&nwfilter_driver) < 0)
return -1;
#ifdef WITH_LIBVIRTD
if (virRegisterStateDriver(&state_driver) == -1) return -1;
if (virRegisterStateDriver(&state_driver) == -1) < 0)
return -1;
#endif
return 0;
......
......@@ -1194,7 +1194,9 @@ static virStateDriver stateDriver = {
int
secretRegister(void)
{
virRegisterSecretDriver(&secretDriver);
virRegisterStateDriver(&stateDriver);
if (virRegisterSecretDriver(&secretDriver) < 0)
return -1;
if (virRegisterStateDriver(&stateDriver) < 0)
return -1;
return 0;
}
......@@ -2696,7 +2696,8 @@ int storageRegister(void)
{
if (virRegisterStorageDriver(&storageDriver) < 0)
return -1;
virRegisterStateDriver(&stateDriver);
if (virRegisterStateDriver(&stateDriver) < 0)
return -1;
return 0;
}
......
......@@ -2909,7 +2909,9 @@ static virStateDriver umlStateDriver = {
};
int umlRegister(void) {
virRegisterDriver(&umlDriver);
virRegisterStateDriver(&umlStateDriver);
if (virRegisterDriver(&umlDriver) < 0)
return -1;
if (virRegisterStateDriver(&umlStateDriver) < 0)
return -1;
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册