提交 40f8708e 编写于 作者: J Ján Tomko 提交者: Cole Robinson

Do not crash on gluster snapshots with no host name

virStorageFileBackendGlusterInit did not check nhosts.

https://bugzilla.redhat.com/show_bug.cgi?id=1162974
(cherry picked from commit b66288fa)
上级 1aeac2af
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册