]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virt-aa-helper: Use virFileCanonicalizePath()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 11 Jun 2025 11:19:12 +0000 (13:19 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 2 Jul 2025 11:53:53 +0000 (13:53 +0200)
While use of realpath() is not forbidden, our some of our mocks
already have a test friendly reimplementation of
virFileCanonicalizePath(). Use the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/security/virt-aa-helper.c

index e3802c18beba039e5887fef5ba5c67756c9ecef2..d4358ebf9c8a16754baa17ed731d3fddf4ed0b7f 100644 (file)
@@ -712,7 +712,7 @@ vah_add_path(virBuffer *buf, const char *path, const char *perms, bool recursive
         tmp = g_strdup(path);
     } else {
         pathtmp = g_strdup(path + strlen(pathdir));
-        if ((pathreal = realpath(pathdir, NULL)) == NULL) {
+        if (!(pathreal = virFileCanonicalizePath(pathdir))) {
             vah_error(NULL, 0, pathdir);
             vah_error(NULL, 0, _("could not find realpath"));
             return rc;