If we have no imagelabel to set (e.g. the domain was created
by qemu-attach where we don't generate an imagelabel) return
success instead of crashing.

https://bugzilla.redhat.com/show_bug.cgi?id=1161831
---
 src/security/security_selinux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index f96be50..db0df7d 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1970,7 +1970,7 @@ 
virSecuritySELinuxSetSavedStateLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
     virSecurityLabelDefPtr secdef;
 
     secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME);
-    if (!secdef || !secdef->relabel)
+    if (!secdef || !secdef->relabel || !secdef->imagelabel)
         return 0;
 
     return virSecuritySELinuxSetFilecon(savefile, secdef->imagelabel);
-- 
2.0.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to