mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
utils: storage: Canonicalize paths only for local filesystems
Now that virStorageFileGetMetadataFromBuf is used only for remote filesystems, don't canonicalize the path in it.
This commit is contained in:
parent
34d86185ec
commit
92dc2dabb3
@ -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,9 +1089,16 @@ virStorageFileGetMetadataFromFD(const char *path,
|
||||
|
||||
{
|
||||
virStorageSourcePtr ret = NULL;
|
||||
char *canonPath = NULL;
|
||||
|
||||
if (!(ret = virStorageFileMetadataNew(path, format)))
|
||||
if (!(canonPath = canonicalize_file_name(path))) {
|
||||
virReportSystemError(errno, _("unable to resolve '%s'"), path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(ret = virStorageFileMetadataNew(canonPath, format)))
|
||||
goto cleanup;
|
||||
|
||||
|
||||
if (virStorageFileGetMetadataFromFDInternal(ret, fd, backingFormat) < 0) {
|
||||
virStorageSourceFree(ret);
|
||||
@ -1106,6 +1106,7 @@ virStorageFileGetMetadataFromFD(const char *path,
|
||||
}
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(canonPath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user