提交 90ebc54e 编写于 作者: J Jesse J. Cook 提交者: Michal Privoznik

dom event example: init before register event impl

In the domain-events example C code virEventRegisterDefaultImpl was being
called before virConnectOpen without first calling virInitialize. While this
code worked, it is incorrect. Adding a call to g_string_new prior to the call
to virEventRegisterDefaultImpl would cause the code to break. This fix will
help avoid unintentional misue of the API.

Relates to: Ret Hat Bugzilla - Bug 961155
上级 353871b2
......@@ -468,6 +468,11 @@ int main(int argc, char **argv)
return -1;
}
if (virInitialize() < 0) {
fprintf(stderr, "Failed to initialize libvirt");
return -1;
}
virEventRegisterDefaultImpl();
virConnectPtr dconn = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册