提交 b66288fa 编写于 作者: J Ján Tomko

Do not crash on gluster snapshots with no host name

virStorageFileBackendGlusterInit did not check nhosts.

https://bugzilla.redhat.com/show_bug.cgi?id=1162974
上级 cce8e5f7
...@@ -571,9 +571,17 @@ virStorageFileBackendGlusterInit(virStorageSourcePtr src) ...@@ -571,9 +571,17 @@ virStorageFileBackendGlusterInit(virStorageSourcePtr src)
{ {
virStorageFileBackendGlusterPrivPtr priv = NULL; virStorageFileBackendGlusterPrivPtr priv = NULL;
virStorageNetHostDefPtr host = &(src->hosts[0]); virStorageNetHostDefPtr host = &(src->hosts[0]);
const char *hostname = host->name; const char *hostname;
int port = 0; 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)", VIR_DEBUG("initializing gluster storage file %p (gluster://%s:%s/%s%s)",
src, hostname, host->port ? host->port : "0", src, hostname, host->port ? host->port : "0",
NULLSTR(src->volume), src->path); NULLSTR(src->volume), src->path);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册