[PATCH 3/3] utils: storage: Canonicalize paths only for local filesystems

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

 



Now that virStorageFileGetMetadataFromBuf is used only for remote
filesystems, don't canonicalize the path in it.
---
 src/util/virstoragefile.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 4329395..2feda67 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -952,15 +952,8 @@ virStorageFileMetadataNew(const char *path,
     if (VIR_STRDUP(ret->relPath, path) < 0)
         goto error;

-    if (virStorageIsFile(path)) {
-        if (!(ret->path = canonicalize_file_name(path))) {
-            virReportSystemError(errno, _("unable to resolve '%s'"), path);
-            goto error;
-        }
-    } else {
-        if (VIR_STRDUP(ret->path, path) < 0)
-            goto error;
-    }
+    if (VIR_STRDUP(ret->path, path) < 0)
+        goto error;

     return ret;

@@ -1096,16 +1089,24 @@ virStorageFileGetMetadataFromFD(const char *path,

 {
     virStorageSourcePtr ret = NULL;
+    char *canonPath = NULL;
+
+    if (!(canonPath = canonicalize_file_name(path))) {
+        virReportSystemError(errno, _("unable to resolve '%s'"), path);
+        goto cleanup;
+    }

-    if (!(ret = virStorageFileMetadataNew(path, format)))
+    if (!(ret = virStorageFileMetadataNew(canonPath, format)))
         goto cleanup;

+
     if (virStorageFileGetMetadataFromFDInternal(ret, fd, backingFormat) < 0) {
         virStorageSourceFree(ret);
         ret = NULL;
     }

  cleanup:
+    VIR_FREE(canonPath);
     return ret;
 }

-- 
1.9.3

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




[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]