qemu_set_log_filename: filename argument may be NULL

NULL is a valid log filename used to indicate we want to use stderr
but qemu_set_log_filename (which is called by bsd-user/main.c) was not
handling it correctly.

That also made redundant a couple of NULL checks in calling code which
have been removed.

Signed-off-by: Salvador Fandino <salvador@qindel.com>
Message-Id: <20200123193626.19956-1-salvador@qindel.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Salvador Fandino 2020-01-23 20:36:26 +01:00 committed by Stefan Hajnoczi
parent d4aceb2eb7
commit e144a605a6
3 changed files with 18 additions and 19 deletions

View file

@ -229,9 +229,7 @@ void trace_init_file(const char *file)
/* 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 (file) {
qemu_set_log_filename(file, &error_fatal);
}
qemu_set_log_filename(file, &error_fatal);
#else
if (file) {
fprintf(stderr, "error: --trace file=...: "