mirror of https://gitee.com/openkylin/libvirt.git
util: virstoragefile: Don't mangle data stored about directories
Don't remove detected metadata about directory based storage volumes.
This commit is contained in:
parent
44551275a9
commit
cc92ee32cd
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue