aboutsummaryrefslogtreecommitdiff
path: root/trace
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2016-06-15 19:27:16 +0200
committerMarkus Armbruster <armbru@redhat.com>2016-06-20 16:39:08 +0200
commitdaa76aa416b1e18ab1fac650ff53d966d8f21f68 (patch)
treea906532b58132857a76f8979b04dd6869b5e69d5 /trace
parentbd6fee9f1263dc5ba487c7ac57d33a727af63c00 (diff)
downloadqemu-daa76aa416b1e18ab1fac650ff53d966d8f21f68.zip
qemu-daa76aa416b1e18ab1fac650ff53d966d8f21f68.tar.gz
qemu-daa76aa416b1e18ab1fac650ff53d966d8f21f68.tar.bz2
log: Fix qemu_set_log_filename() error handling
When qemu_set_log_filename() detects an invalid file name, it reports an error, closes the log file (if any), and starts logging to stderr (unless daemonized or nothing is being logged). This is wrong. Asking for an invalid log file on the command line should be fatal. Asking for one in the monitor should fail without messing up an existing logfile. Fix by converting qemu_set_log_filename() to Error. Pass it &error_fatal, except for hmp_logfile report errors. This also permits testing without a subprocess, so do that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1466011636-6112-4-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'trace')
-rw-r--r--trace/control.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/trace/control.c b/trace/control.c
index d099f73..e1556a3 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -19,6 +19,7 @@
#ifdef CONFIG_TRACE_LOG
#include "qemu/log.h"
#endif
+#include "qapi/error.h"
#include "qemu/error-report.h"
#include "monitor/monitor.h"
@@ -187,7 +188,7 @@ void trace_init_file(const char *file)
* only applies to the simple backend; use "-D" for the log backend.
*/
if (file) {
- qemu_set_log_filename(file);
+ qemu_set_log_filename(file, &error_fatal);
}
#else
if (file) {