[PATCH] utils: Canonicalize paths before comparing them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Resolves: https://issues.redhat.com/browse/RHEL-79165
Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 src/util/virfile.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index 6ac0f4efb3..7cab3d0cd6 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -3823,10 +3823,13 @@ virFileIsSharedFSOverride(const char *path,
     if (!path || path[0] != '/' || !overrides)
         return false;
 
-    if (g_strv_contains((const char *const *) overrides, path))
-        return true;
+    /* Overrides have been canonicalized ahead of time, so we need to
+     * do the same for the provided path or we'll never be able to
+     * find a match if symlinks are involved */
+    dirpath = virFileCanonicalizePath(path);
 
-    dirpath = g_strdup(path);
+    if (g_strv_contains((const char *const *) overrides, dirpath))
+        return true;
 
     /* Continue until we've scanned the entire path */
     while (p != dirpath) {
-- 
2.48.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux