[libvirt] [PATCH 17/18] util: virstoragefile: Don't mangle data stored about directories

Peter Krempa pkrempa at redhat.com
Sun Apr 20 22:13:21 UTC 2014


Don't remove detected metadata about directory based storage volumes.
---
 src/util/virstoragefile.c | 7 ++-----
 tests/virstoragetest.c    | 3 +++
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 37cda8e..8d5ef2f 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1038,11 +1038,8 @@ virStorageFileGetMetadataFromFDInternal(virStorageSourcePtr meta,
     }

     if (S_ISDIR(sb.st_mode)) {
-        /* No header to probe for directories, but also no backing
-         * file; therefore, no inclusion loop is possible, and we
-         * don't need canonName or relDir.  */
-        VIR_FREE(meta->relDir);
-        VIR_FREE(meta->path);
+        /* No header to probe for directories, but also no backing file. Just
+         * update the metadata.*/
         meta->type = VIR_STORAGE_TYPE_DIR;
         meta->format = VIR_STORAGE_FILE_DIR;
         ret = 0;
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 19f3f58..370b8c2 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -709,6 +709,9 @@ mymain(void)
     testFileData dir = {
         .pathRel = "dir",
         .pathAbs = absdir,
+        .path = canondir,
+        .relDirRel = ".",
+        .relDirAbs = datadir,
         .type = VIR_STORAGE_TYPE_DIR,
         .format = VIR_STORAGE_FILE_DIR,
     };
-- 
1.9.1




More information about the libvir-list mailing list