[4/7] security: apparmor: Pass virStorageSource to add_file_path

Message ID eb92dc26ba1948022df8d41e2c3a9b86fa808e54.1570551720.git.crobinso@redhat.com
State Accepted
Commit 7c0bf48bc9ec1d1974b3d32d27a688da3cf37191
Headers show
Series
  • security: apparmor: prep for qcow2 data_file
Related show

Commit Message

Cole Robinson Oct. 8, 2019, 4:22 p.m.
The virStorageSource must have everything it needs

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/security/virt-aa-helper.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

-- 
2.23.0

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

Patch

diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 7148e3c760..9f39eb2e2b 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -911,20 +911,19 @@  file_iterate_pci_cb(virPCIDevicePtr dev ATTRIBUTE_UNUSED,
 }
 
 static int
-add_file_path(virDomainDiskDefPtr disk,
-              const char *path,
+add_file_path(virStorageSourcePtr src,
               size_t depth,
               virBufferPtr buf)
 {
     int ret;
 
     if (depth == 0) {
-        if (disk->src->readonly)
-            ret = vah_add_file(buf, path, "rk");
+        if (src->readonly)
+            ret = vah_add_file(buf, src->path, "rk");
         else
-            ret = vah_add_file(buf, path, "rwk");
+            ret = vah_add_file(buf, src->path, "rwk");
     } else {
-        ret = vah_add_file(buf, path, "rk");
+        ret = vah_add_file(buf, src->path, "rk");
     }
 
     if (ret != 0)
@@ -945,7 +944,7 @@  disk_add_files(virDomainDiskDefPtr disk,
         /* execute the callback only for local storage */
         if (virStorageSourceIsLocalStorage(tmp) &&
             tmp->path) {
-            if (add_file_path(disk, tmp->path, depth, buf) < 0)
+            if (add_file_path(tmp, depth, buf) < 0)
                 return -1;
         }