mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 09:25:18 +00:00
conf: virDomainDiskSourceFormat: check for srcpool presence correctly
As a guard against programming errors, one part of the condition only dereferences srcpool if it exists, other one does not. Move the check up one level so that it actually has a chance to do something useful. Fixes: 19b1c0d31988a3a10c4694c10c27eb15c018f450 Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
1fdca3083b
commit
66e84b8a95
@ -22363,14 +22363,12 @@ virDomainDiskSourceFormat(virBuffer *buf,
|
||||
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||
|
||||
if (src->type == VIR_STORAGE_TYPE_VOLUME) {
|
||||
if (src->srcpool) {
|
||||
virBufferEscapeString(&attrBuf, " pool='%s'", src->srcpool->pool);
|
||||
virBufferEscapeString(&attrBuf, " volume='%s'", src->srcpool->volume);
|
||||
if (src->srcpool->mode)
|
||||
virBufferAsprintf(&attrBuf, " mode='%s'",
|
||||
virStorageSourcePoolModeTypeToString(src->srcpool->mode));
|
||||
}
|
||||
if (src->type == VIR_STORAGE_TYPE_VOLUME && src->srcpool) {
|
||||
virBufferEscapeString(&attrBuf, " pool='%s'", src->srcpool->pool);
|
||||
virBufferEscapeString(&attrBuf, " volume='%s'", src->srcpool->volume);
|
||||
if (src->srcpool->mode)
|
||||
virBufferAsprintf(&attrBuf, " mode='%s'",
|
||||
virStorageSourcePoolModeTypeToString(src->srcpool->mode));
|
||||
|
||||
if (flags & VIR_DOMAIN_DEF_FORMAT_VOLUME_TRANSLATED &&
|
||||
src->srcpool->actualtype != VIR_STORAGE_TYPE_NONE) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user