]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tracing: only allow -trace to override -D if set
authorAlex Bennée <alex.bennee@linaro.org>
Tue, 25 Feb 2020 12:47:00 +0000 (12:47 +0000)
committerAlex Bennée <alex.bennee@linaro.org>
Tue, 25 Feb 2020 20:20:23 +0000 (20:20 +0000)
Otherwise any -D settings the user may have made get ignored.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Robert Foley <robert.foley@linaro.org>
Message-Id: <20200225124710.14152-10-alex.bennee@linaro.org>

trace/control.c

index 6c775e68eba1ce806be4b3340a0176525b8e5f43..2ffe0008184869823fa5baf8ee43455dd3798900 100644 (file)
@@ -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=...: "