[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] log: Fix qemu_set_log_filename() error hand
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] log: Fix qemu_set_log_filename() error handling |
Date: |
Wed, 15 Jun 2016 13:11:56 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 06/15/2016 11:27 AM, Markus Armbruster wrote:
> 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 <address@hidden>
> ---
> bsd-user/main.c | 3 ++-
> include/qemu/log.h | 2 +-
> linux-user/main.c | 3 ++-
> monitor.c | 7 ++++++-
> tests/test-logging.c | 41 ++++++++---------------------------------
> trace/control.c | 3 ++-
> util/log.c | 6 +++---
> vl.c | 2 +-
> 8 files changed, 25 insertions(+), 42 deletions(-)
>
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index 9f592be..3d6a4f4 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -20,6 +20,7 @@
> #include <machine/trap.h>
> #include <sys/mman.h>
>
> +#include "qapi/error.h"
> #include "qemu.h"
> #include "qemu/path.h"
> #include "qemu/help_option.h"
> @@ -848,7 +849,7 @@ int main(int argc, char **argv)
>
> /* init debug */
> qemu_log_needs_buffers();
> - qemu_set_log_filename(log_file);
> + qemu_set_log_filename(log_file, &error_fatal);
Commit race between this patch and Denis' series:
https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg00515.html
Whoever goes in second will have a build failure until all the new uses
are also converted.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature