mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 03:21:44 +03:00
util: move declarations in virStorageFileChainLookup
Use g_autofree and move the declarations to the beginning of the block. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d8c9584aed
commit
908bcaa452
@ -1597,7 +1597,6 @@ virStorageFileChainLookup(virStorageSourcePtr chain,
|
||||
{
|
||||
virStorageSourcePtr prev;
|
||||
const char *start = chain->path;
|
||||
char *parentDir = NULL;
|
||||
bool nameIsFile = virStorageIsFile(name);
|
||||
|
||||
if (!parent)
|
||||
@ -1626,15 +1625,16 @@ virStorageFileChainLookup(virStorageSourcePtr chain,
|
||||
break;
|
||||
|
||||
if (nameIsFile && virStorageSourceIsLocalStorage(chain)) {
|
||||
g_autofree char *parentDir = NULL;
|
||||
int result;
|
||||
|
||||
if (*parent && virStorageSourceIsLocalStorage(*parent))
|
||||
parentDir = g_path_get_dirname((*parent)->path);
|
||||
else
|
||||
parentDir = g_strdup(".");
|
||||
|
||||
int result = virFileRelLinkPointsTo(parentDir, name,
|
||||
chain->path);
|
||||
|
||||
VIR_FREE(parentDir);
|
||||
result = virFileRelLinkPointsTo(parentDir, name,
|
||||
chain->path);
|
||||
|
||||
if (result < 0)
|
||||
goto error;
|
||||
|
Loading…
Reference in New Issue
Block a user