log: do not log if QEMU is daemonized but without -D
commitc586eac33670c198c6c9ceb1419aa99dafcce907
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 29 Feb 2016 11:18:40 +0000 (29 12:18 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 7 Mar 2016 12:18:28 +0000 (7 13:18 +0100)
tree18ae9a6b76fb6125225bf47e36d668a9960aff4e
parent1464ad45cd6cdeb0b5c1a54d3d3791396e47e52f
log: do not log if QEMU is daemonized but without -D

Commit 96c33a4 ("log: Redirect stderr to logfile if deamonized",
2016-02-22) wanted to move stderr of a daemonized QEMU to the file
specified with -D.

However, if -D was not passed, the patch had the side effect of not
redirecting stderr to /dev/null.  This happened because qemu_logfile
was set to stderr rather than the expected value of NULL.  The fix
is simply in the "if" condition of do_qemu_set_log; the "if" for
closing the file is also changed to match.

Reported-by: Jan Tomko <jtomko@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
util/log.c