From cc92ee32cde8d0ce0092d3ff30aece90af7b1781 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 18 Apr 2014 10:07:41 +0200 Subject: [PATCH] util: virstoragefile: Don't mangle data stored about directories 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 eb892680b1..a716b5d743 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1043,11 +1043,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 19f3f58990..370b8c21cf 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, };