提交 85ccf42c 编写于 作者: O Osier Yang 提交者: Eric Blake

util: Fix bug which will cause libvirtd crash

"virCommandRun": if "cmd->outbuf" or "cmd->errbuf" is NULL,
libvirtd will be crashed when trying to start a qemu domain
(which invokes "virCommandRun"), it caused by we try to use
"*cmd->outbuf" and "*cmd->errbuf" regardless of cmd->outbuf
or cmd->errbuf is NULL.

* src/util/command.c (virCommandRun)
上级 58d0f4d7
......@@ -931,8 +931,8 @@ virCommandRun(virCommandPtr cmd, int *exitstatus)
ret = -1;
VIR_DEBUG("Result stdout: '%s' stderr: '%s'",
NULLSTR(*cmd->outbuf),
NULLSTR(*cmd->errbuf));
cmd->outbuf ? NULLSTR(*cmd->outbuf) : "(null)",
cmd->errbuf ? NULLSTR(*cmd->errbuf) : "(null)");
/* Reset any capturing, in case caller runs
* this identical command again */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册