[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/15] log: do not log if QEMU is daemonized but with
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 01/15] log: do not log if QEMU is daemonized but without -D |
Date: |
Mon, 7 Mar 2016 18:36:47 +0100 |
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 <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
util/log.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/util/log.c b/util/log.c
index a7ddc7e..8b921de 100644
--- a/util/log.c
+++ b/util/log.c
@@ -56,7 +56,8 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
#ifdef CONFIG_TRACE_LOG
qemu_loglevel |= LOG_TRACE;
#endif
- if ((qemu_loglevel || is_daemonized()) && !qemu_logfile) {
+ if (!qemu_logfile &&
+ (is_daemonized() ? logfilename != NULL : qemu_loglevel)) {
if (logfilename) {
qemu_logfile = fopen(logfilename, log_append ? "a" : "w");
if (!qemu_logfile) {
@@ -72,6 +73,7 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
}
} else {
/* Default to stderr if no log file specified */
+ assert(!is_daemonized());
qemu_logfile = stderr;
}
/* must avoid mmap() usage of glibc by setting a buffer "by hand" */
@@ -89,7 +91,8 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
log_append = 1;
}
}
- if (!qemu_loglevel && !is_daemonized() && qemu_logfile) {
+ if (qemu_logfile &&
+ (is_daemonized() ? logfilename == NULL : !qemu_loglevel)) {
qemu_log_close();
}
}
--
2.5.0
- [Qemu-devel] [PULL 00/15] Memory changes and misc bug fixes for 2016-03-07, Paolo Bonzini, 2016/03/07
- [Qemu-devel] [PULL 01/15] log: do not log if QEMU is daemonized but without -D,
Paolo Bonzini <=
- [Qemu-devel] [PULL 02/15] i8257: fix Terminal Count status, Paolo Bonzini, 2016/03/07
- [Qemu-devel] [PULL 03/15] exec: Return RAMBlock pointer from allocating functions, Paolo Bonzini, 2016/03/07
- [Qemu-devel] [PULL 04/15] memory: Move assignment to ram_block to memory_region_init_*, Paolo Bonzini, 2016/03/07
- [Qemu-devel] [PULL 05/15] memory: Implement memory_region_get_ram_addr with mr->ram_block, Paolo Bonzini, 2016/03/07
- [Qemu-devel] [PULL 06/15] memory: Drop MemoryRegion.ram_addr, Paolo Bonzini, 2016/03/07
- [Qemu-devel] [PULL 07/15] exec: Pass RAMBlock pointer to qemu_ram_free, Paolo Bonzini, 2016/03/07
- [Qemu-devel] [PULL 08/15] exec: Factor out section_covers_addr, Paolo Bonzini, 2016/03/07
- [Qemu-devel] [PULL 11/15] doc/memory.txt: correct a logic error, Paolo Bonzini, 2016/03/07
- [Qemu-devel] [PULL 09/15] exec: Introduce AddressSpaceDispatch.mru_section, Paolo Bonzini, 2016/03/07
- [Qemu-devel] [PULL 12/15] doc/memory.txt: correct description of MemoryRegionOps fields, Paolo Bonzini, 2016/03/07