Avoid the "audit" label to simplify control flow.
---
src/qemu/qemu_hotplug.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index f6e98b4..0ad467e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -107,7 +107,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
qemuDomainObjExitMonitor(driver, vm);
if (ret < 0)
- goto audit;
+ goto error;
virObjectRef(vm);
/* we don't want to report errors from media tray_open polling */
@@ -127,7 +127,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Unable to eject media"));
ret = -1;
- goto audit;
+ goto error;
}
src = virDomainDiskGetSource(disk);
@@ -153,7 +153,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
src, format);
qemuDomainObjExitMonitor(driver, vm);
}
- audit:
+
virDomainAuditDisk(vm, origdisk->src, disk->src, "update", ret >=
0);
if (ret < 0)
@@ -180,6 +180,8 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
return ret;
error:
+ virDomainAuditDisk(vm, origdisk->src, disk->src, "update", false);
+
if (virSecurityManagerRestoreDiskLabel(driver->securityManager,
vm->def, disk) < 0)
VIR_WARN("Unable to restore security label on new media %s", src);
--
2.0.2