mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
netcf: Don't complain when cleanup is called before init
netcfStateInitialize() initializes the driverState variable, and when netcfStateCleanup is called, it will call virReportError() if driverState is NULL. This is not consistent with what other state objects are doing, they return -1 without reporting an error in such cases. See also https://www.redhat.com/archives/libvir-list/2013-October/msg00809.html: On Thu, Oct 17, 2013 at 01:40:19PM +0100, Daniel P. Berrange wrote: > We don't want virStateCleanup to skip execution if virStateInitialize > has failed though - every callback in virStateCleanup should be written > to be safe if its corresponding init function hasn't run.
This commit is contained in:
parent
9712c2510e
commit
68eb3709a1
@ -100,11 +100,8 @@ netcfStateInitialize(bool privileged ATTRIBUTE_UNUSED,
|
|||||||
static int
|
static int
|
||||||
netcfStateCleanup(void)
|
netcfStateCleanup(void)
|
||||||
{
|
{
|
||||||
if (!driverState) {
|
if (!driverState)
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
||||||
_("Attempt to close netcf state driver already closed"));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
if (virObjectUnref(driverState)) {
|
if (virObjectUnref(driverState)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
Loading…
Reference in New Issue
Block a user