mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 03:21:44 +03:00
Do not crash on gluster snapshots with no host name
virStorageFileBackendGlusterInit did not check nhosts. https://bugzilla.redhat.com/show_bug.cgi?id=1162974
This commit is contained in:
parent
cce8e5f739
commit
b66288faab
@ -571,9 +571,17 @@ virStorageFileBackendGlusterInit(virStorageSourcePtr src)
|
||||
{
|
||||
virStorageFileBackendGlusterPrivPtr priv = NULL;
|
||||
virStorageNetHostDefPtr host = &(src->hosts[0]);
|
||||
const char *hostname = host->name;
|
||||
const char *hostname;
|
||||
int port = 0;
|
||||
|
||||
if (src->nhosts != 1) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Expected exactly 1 host for the gluster volume"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
hostname = host->name;
|
||||
|
||||
VIR_DEBUG("initializing gluster storage file %p (gluster://%s:%s/%s%s)",
|
||||
src, hostname, host->port ? host->port : "0",
|
||||
NULLSTR(src->volume), src->path);
|
||||
|
Loading…
Reference in New Issue
Block a user