diff --git a/src/security/security_dac.c b/src/security/security_dac.c index b3e7c6bd17..f3fbede737 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -884,6 +884,7 @@ virSecurityDACSetImageLabelInternal(virSecurityManagerPtr mgr, virSecurityDeviceLabelDefPtr parent_seclabel = NULL; virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); bool remember; + bool is_toplevel = parent == src; uid_t user; gid_t group; @@ -928,7 +929,7 @@ virSecurityDACSetImageLabelInternal(virSecurityManagerPtr mgr, * but the top layer, or read only image, or disk explicitly * marked as shared. */ - remember = src == parent && !src->readonly && !src->shared; + remember = is_toplevel && !src->readonly && !src->shared; return virSecurityDACSetOwnership(mgr, src, NULL, user, group, remember); }