mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
initialize "meta" in virStorageFileGetMetadata, not in each caller
Do not require each caller of virStorageFileGetMetadata and virStorageFileGetMetadataFromFD to first clear the storage of the "meta" buffer. Instead, initialize that storage in virStorageFileGetMetadataFromFD. * src/util/storage_file.c (virStorageFileGetMetadataFromFD): Clear "meta" here, not before each of the following callers. * src/qemu/qemu_driver.c (qemuSetupDiskCgroup): Don't clear "meta" here. (qemuTeardownDiskCgroup): Likewise. * src/qemu/qemu_security_dac.c (qemuSecurityDACSetSecurityImageLabel): Likewise. * src/security/security_selinux.c (SELinuxSetSecurityImageLabel): Likewise. * src/security/virt-aa-helper.c (get_files): Likewise.
This commit is contained in:
parent
e638a2461d
commit
dcf30d9c25
@ -2982,8 +2982,6 @@ static int qemuSetupDiskCgroup(virCgroupPtr cgroup,
|
||||
}
|
||||
}
|
||||
|
||||
memset(&meta, 0, sizeof(meta));
|
||||
|
||||
rc = virStorageFileGetMetadata(path, &meta);
|
||||
|
||||
if (path != disk->src)
|
||||
@ -3030,8 +3028,6 @@ static int qemuTeardownDiskCgroup(virCgroupPtr cgroup,
|
||||
}
|
||||
}
|
||||
|
||||
memset(&meta, 0, sizeof(meta));
|
||||
|
||||
rc = virStorageFileGetMetadata(path, &meta);
|
||||
|
||||
if (path != disk->src)
|
||||
@ -9386,7 +9382,6 @@ static int qemuDomainGetBlockInfo(virDomainPtr dom,
|
||||
}
|
||||
|
||||
/* Probe for magic formats */
|
||||
memset(&meta, 0, sizeof(meta));
|
||||
if (virStorageFileGetMetadataFromFD(path, fd, &meta) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -115,8 +115,6 @@ qemuSecurityDACSetSecurityImageLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
|
||||
virStorageFileMetadata meta;
|
||||
int ret;
|
||||
|
||||
memset(&meta, 0, sizeof(meta));
|
||||
|
||||
ret = virStorageFileGetMetadata(path, &meta);
|
||||
|
||||
if (path != disk->src)
|
||||
|
@ -454,8 +454,6 @@ SELinuxSetSecurityImageLabel(virDomainObjPtr vm,
|
||||
virStorageFileMetadata meta;
|
||||
int ret;
|
||||
|
||||
memset(&meta, 0, sizeof(meta));
|
||||
|
||||
ret = virStorageFileGetMetadata(path, &meta);
|
||||
|
||||
if (path != disk->src)
|
||||
|
@ -830,8 +830,6 @@ get_files(vahControl * ctl)
|
||||
do {
|
||||
virStorageFileMetadata meta;
|
||||
|
||||
memset(&meta, 0, sizeof(meta));
|
||||
|
||||
ret = virStorageFileGetMetadata(path, &meta);
|
||||
|
||||
if (path != ctl->def->disks[i]->src)
|
||||
|
@ -275,6 +275,8 @@ virStorageFileGetMetadataFromFD(const char *path,
|
||||
unsigned char head[20*512]; /* vmdk4GetBackingStore needs this much. */
|
||||
int len, i;
|
||||
|
||||
memset(meta, 0, sizeof (*meta));
|
||||
|
||||
/* If all else fails, call it a raw file */
|
||||
meta->format = VIR_STORAGE_FILE_RAW;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user