diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-01-31 17:36:59 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-01-31 17:37:00 +0000 |
commit | 28db64fce555a03b4ca256d5b6f4290abdfbd9e8 (patch) | |
tree | dbf7d5a1e9f85de503956a2ac81327448cc37b82 /util | |
parent | aeab8e5eb220cc5ff84b0b68b9afccc611bf0fcd (diff) | |
parent | e144a605a614d22165000c69e8e1dc6986d45cd8 (diff) | |
download | qemu-28db64fce555a03b4ca256d5b6f4290abdfbd9e8.zip qemu-28db64fce555a03b4ca256d5b6f4290abdfbd9e8.tar.gz qemu-28db64fce555a03b4ca256d5b6f4290abdfbd9e8.tar.bz2 |
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
Pull request
# gpg: Signature made Thu 30 Jan 2020 21:38:06 GMT
# gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8
* remotes/stefanha/tags/tracing-pull-request:
qemu_set_log_filename: filename argument may be NULL
hw/display/qxl.c: Use trace_event_get_state_backends()
memory.c: Use trace_event_get_state_backends()
docs/devel/tracing.txt: Recommend only trace_event_get_state_backends()
Makefile: Keep trace-events-subdirs ordered
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/log.c | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -148,25 +148,29 @@ void qemu_log_needs_buffers(void) * Allow the user to include %d in their logfile which will be * substituted with the current PID. This is useful for debugging many * nested linux-user tasks but will result in lots of logs. + * + * filename may be NULL. In that case, log output is sent to stderr */ void qemu_set_log_filename(const char *filename, Error **errp) { - char *pidstr; g_free(logfilename); logfilename = NULL; - pidstr = strstr(filename, "%"); - if (pidstr) { - /* We only accept one %d, no other format strings */ - if (pidstr[1] != 'd' || strchr(pidstr + 2, '%')) { - error_setg(errp, "Bad logfile format: %s", filename); - return; - } else { - logfilename = g_strdup_printf(filename, getpid()); - } - } else { - logfilename = g_strdup(filename); + if (filename) { + char *pidstr = strstr(filename, "%"); + if (pidstr) { + /* We only accept one %d, no other format strings */ + if (pidstr[1] != 'd' || strchr(pidstr + 2, '%')) { + error_setg(errp, "Bad logfile format: %s", filename); + return; + } else { + logfilename = g_strdup_printf(filename, getpid()); + } + } else { + logfilename = g_strdup(filename); + } } + qemu_log_close(); qemu_set_log(qemu_loglevel); } |