]> git.proxmox.com Git - mirror_qemu.git/commit - vl.c
log: Fix qemu_set_log_filename() error handling
authorMarkus Armbruster <armbru@redhat.com>
Wed, 15 Jun 2016 17:27:16 +0000 (19:27 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 20 Jun 2016 14:39:08 +0000 (16:39 +0200)
commitdaa76aa416b1e18ab1fac650ff53d966d8f21f68
treea906532b58132857a76f8979b04dd6869b5e69d5
parentbd6fee9f1263dc5ba487c7ac57d33a727af63c00
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>
bsd-user/main.c
include/qemu/log.h
linux-user/main.c
monitor.c
tests/test-logging.c
trace/control.c
util/log.c
vl.c