qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, alex.bennee@linaro.org,
	"Denis V. Lunev" <den@openvz.org>
Subject: Re: [Qemu-devel] [PATCH 3/3] log: Fix qemu_set_log_filename() error handling
Date: Wed, 15 Jun 2016 13:11:56 -0600	[thread overview]
Message-ID: <5761A87C.1030600@redhat.com> (raw)
In-Reply-To: <1466011636-6112-4-git-send-email-armbru@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1976 bytes --]

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 <armbru@redhat.com>
> ---
>  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 <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

      reply	other threads:[~2016-06-15 19:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 17:27 [Qemu-devel] [PATCH 0/3] log: Fix error handling and a memory leak Markus Armbruster
2016-06-15 17:27 ` [Qemu-devel] [PATCH 1/3] log: Plug memory leak on multiple -dfilter Markus Armbruster
2016-06-15 18:42   ` Eric Blake
2016-06-15 17:27 ` [Qemu-devel] [PATCH 2/3] log: Fix qemu_set_dfilter_ranges() error reporting Markus Armbruster
2016-06-15 19:06   ` Eric Blake
2016-06-16  7:40     ` Markus Armbruster
2016-06-15 17:27 ` [Qemu-devel] [PATCH 3/3] log: Fix qemu_set_log_filename() error handling Markus Armbruster
2016-06-15 19:11   ` Eric Blake [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5761A87C.1030600@redhat.com \
    --to=eblake@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).