1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-26 03:21:44 +03:00

storagefile: qcow1: Fix check for empty backing file

From f772b3d91f the intention of this code seems to be to set
format=NONE when the image does not have a backing file. However
'buf' here is the whole qcow1 file header. What we want to be
checking is 'res' which is the parsed backing file path.
qcowXGetBackingStore sets this to NULL when there's no backing file.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-10-04 18:00:55 -04:00
parent 9f508ec7ca
commit b00616870b

View File

@ -578,7 +578,7 @@ qcow1GetBackingStore(char **res,
* used to store backing format */
*format = VIR_STORAGE_FILE_AUTO;
ret = qcowXGetBackingStore(res, NULL, buf, buf_size, false);
if (ret == BACKING_STORE_OK && *buf == '\0')
if (ret == BACKING_STORE_OK && !*res)
*format = VIR_STORAGE_FILE_NONE;
return ret;
}