mirror of https://gitee.com/openkylin/libvirt.git
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)
This commit is contained in:
parent
58d0f4d737
commit
85ccf42cd0
|
@ -931,8 +931,8 @@ virCommandRun(virCommandPtr cmd, int *exitstatus)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
VIR_DEBUG("Result stdout: '%s' stderr: '%s'",
|
VIR_DEBUG("Result stdout: '%s' stderr: '%s'",
|
||||||
NULLSTR(*cmd->outbuf),
|
cmd->outbuf ? NULLSTR(*cmd->outbuf) : "(null)",
|
||||||
NULLSTR(*cmd->errbuf));
|
cmd->errbuf ? NULLSTR(*cmd->errbuf) : "(null)");
|
||||||
|
|
||||||
/* Reset any capturing, in case caller runs
|
/* Reset any capturing, in case caller runs
|
||||||
* this identical command again */
|
* this identical command again */
|
||||||
|
|
Loading…
Reference in New Issue