[libvirt] [PATCH 21/30] security: dac: Add is_toplevel to SetImageLabelInternal

Cole Robinson crobinso at redhat.com
Mon Oct 7 21:49:35 UTC 2019


This will simplify future patches and make the logic easier to follow

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/security/security_dac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index bcc781213e..6d0c8a9b1c 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -882,6 +882,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;
 
@@ -926,7 +927,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);
 }
-- 
2.23.0




More information about the libvir-list mailing list