util: virstoragefile: Don't mangle data stored about directories

Don't remove detected metadata about directory based storage volumes.
This commit is contained in:
Peter Krempa 2014-04-18 10:07:41 +02:00
parent 44551275a9
commit cc92ee32cd
2 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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,
};