[2/7] security: apparmor: Remove unused ignoreOpenFailure

Message ID db60244abdd8629d5ea8c13830dccc9bb03f8263.1570551720.git.crobinso@redhat.com
State New
Headers show
Series
  • security: apparmor: prep for qcow2 data_file
Related show

Commit Message

Cole Robinson Oct. 8, 2019, 4:22 p.m.
true is always passed here, so delete the unused code path and
adjust the associated comment

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

---
 src/security/virt-aa-helper.c | 25 +++----------------------
 1 file changed, 3 insertions(+), 22 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 6e358ff5b6..511443dd3e 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -943,30 +943,14 @@  typedef int (*disk_foreach_iterator)(virDomainDiskDefPtr disk,
 
 /* Call iter(disk, name, depth, opaque) for each element of disk and
  * its backing chain in the pre-populated disk->src.backingStore.
- * ignoreOpenFailure determines whether to warn about a chain that
- * mentions a backing file without also having metadata on that
- * file.  */
+ */
 static int
 disk_foreach_path(virDomainDiskDefPtr disk,
-                  bool ignoreOpenFailure,
                   disk_foreach_iterator iter,
                   void *opaque)
 {
     size_t depth = 0;
     virStorageSourcePtr tmp;
-    VIR_AUTOFREE(char *) brokenRaw = NULL;
-
-    if (!ignoreOpenFailure) {
-        if (virStorageFileChainGetBroken(disk->src, &brokenRaw) < 0)
-            return -1;
-
-        if (brokenRaw) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("unable to visit backing chain file %s"),
-                           brokenRaw);
-            return -1;
-        }
-    }
 
     for (tmp = disk->src; virStorageSourceIsBacking(tmp); tmp = tmp->backingStore) {
         /* execute the callback only for local storage */
@@ -1020,12 +1004,9 @@  get_files(vahControl * ctl)
         if (!virStorageSourceHasBacking(disk->src))
             virStorageFileGetMetadata(disk->src, -1, -1, false);
 
-        /* XXX passing ignoreOpenFailure = true to get back to the behavior
-         * from before using virDomainDiskDefForeachPath. actually we should
-         * be passing ignoreOpenFailure = false and handle open errors more
-         * careful than just ignoring them.
+         /* XXX should handle open errors more careful than just ignoring them.
          */
-        if (disk_foreach_path(disk, true, add_file_path, &buf) < 0)
+        if (disk_foreach_path(disk, add_file_path, &buf) < 0)
             goto cleanup;
     }