From 3d88754e2b096ace0f9c2e86dbbb84de4290d421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 25 Feb 2020 12:47:00 +0000 Subject: tracing: only allow -trace to override -D if set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise any -D settings the user may have made get ignored. Signed-off-by: Alex Bennée Tested-by: Laurent Vivier Reviewed-by: Robert Foley Message-Id: <20200225124710.14152-10-alex.bennee@linaro.org> --- trace/control.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'trace/control.c') diff --git a/trace/control.c b/trace/control.c index 6c775e6..2ffe000 100644 --- a/trace/control.c +++ b/trace/control.c @@ -226,10 +226,15 @@ void trace_init_file(const char *file) #ifdef CONFIG_TRACE_SIMPLE st_set_trace_file(file); #elif defined CONFIG_TRACE_LOG - /* If both the simple and the log backends are enabled, "--trace file" - * only applies to the simple backend; use "-D" for the log backend. + /* + * If both the simple and the log backends are enabled, "--trace file" + * only applies to the simple backend; use "-D" for the log + * backend. However we should only override -D if we actually have + * something to override it with. */ - qemu_set_log_filename(file, &error_fatal); + if (file) { + qemu_set_log_filename(file, &error_fatal); + } #else if (file) { fprintf(stderr, "error: --trace file=...: " -- cgit v1.1