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

virsh: fix snapshot-create with no xmlfile

Properly check the return value of vshCommandOptStringReq for xmlfile:
* error out on incorrect input (--xmlfile '')
* use default XML <domainsnapshot/> with no --xmlfile specified

(Broken by commit b2e85855)

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=919826
上级 531b4fe8
......@@ -211,7 +211,9 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd)
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
goto cleanup;
if (vshCommandOptStringReq(ctl, cmd, "xmlfile", &from) < 0) {
if (vshCommandOptStringReq(ctl, cmd, "xmlfile", &from) < 0)
goto cleanup;
if (!from) {
buffer = vshStrdup(ctl, "<domainsnapshot/>");
} else {
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册