From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org,
Kamil Rytarowski <kamil@netbsd.org>,
Paolo Bonzini <pbonzini@redhat.com>,
eblake@redhat.com
Subject: Re: [PATCH v2] Do not use %m in common code to print error messages
Date: Fri, 18 Oct 2019 14:10:46 +0100 [thread overview]
Message-ID: <20191018131046.GG28271@redhat.com> (raw)
In-Reply-To: <20191018130716.25438-1-thuth@redhat.com>
On Fri, Oct 18, 2019 at 03:07:16PM +0200, Thomas Huth wrote:
> The %m format specifier is an extension from glibc - and when compiling
> QEMU for NetBSD, the compiler correctly complains, e.g.:
>
> /home/qemu/qemu-test.ELjfrQ/src/util/main-loop.c: In function 'sigfd_handler':
> /home/qemu/qemu-test.ELjfrQ/src/util/main-loop.c:64:13: warning: %m is only
> allowed in syslog(3) like functions [-Wformat=]
> printf("read from sigfd returned %zd: %m\n", len);
> ^
> Let's use g_strerror() here instead, which is an easy-to-use wrapper
> around the thread-safe strerror_r() function.
>
> While we're at it, also convert the "printf()" in main-loop.c into
> the preferred "error_report()".
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> v2: Do not try to g_free() the strings
>
> hw/misc/tmp421.c | 4 ++--
> util/main-loop.c | 3 ++-
> util/systemd.c | 4 ++--
> 3 files changed, 6 insertions(+), 5 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
WARNING: multiple messages have this Message-ID (diff)
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-trivial@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Kamil Rytarowski <kamil@netbsd.org>,
qemu-devel@nongnu.org
Subject: Re: [PATCH v2] Do not use %m in common code to print error messages
Date: Fri, 18 Oct 2019 14:10:46 +0100 [thread overview]
Message-ID: <20191018131046.GG28271@redhat.com> (raw)
In-Reply-To: <20191018130716.25438-1-thuth@redhat.com>
On Fri, Oct 18, 2019 at 03:07:16PM +0200, Thomas Huth wrote:
> The %m format specifier is an extension from glibc - and when compiling
> QEMU for NetBSD, the compiler correctly complains, e.g.:
>
> /home/qemu/qemu-test.ELjfrQ/src/util/main-loop.c: In function 'sigfd_handler':
> /home/qemu/qemu-test.ELjfrQ/src/util/main-loop.c:64:13: warning: %m is only
> allowed in syslog(3) like functions [-Wformat=]
> printf("read from sigfd returned %zd: %m\n", len);
> ^
> Let's use g_strerror() here instead, which is an easy-to-use wrapper
> around the thread-safe strerror_r() function.
>
> While we're at it, also convert the "printf()" in main-loop.c into
> the preferred "error_report()".
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> v2: Do not try to g_free() the strings
>
> hw/misc/tmp421.c | 4 ++--
> util/main-loop.c | 3 ++-
> util/systemd.c | 4 ++--
> 3 files changed, 6 insertions(+), 5 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2019-10-18 13:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 13:07 [PATCH v2] Do not use %m in common code to print error messages Thomas Huth
2019-10-18 13:07 ` Thomas Huth
2019-10-18 13:10 ` Daniel P. Berrangé [this message]
2019-10-18 13:10 ` Daniel P. Berrangé
2019-10-18 13:42 ` Stefano Garzarella
2019-10-18 13:42 ` Stefano Garzarella
2019-10-18 13:49 ` Kamil Rytarowski
2019-10-18 16:01 ` Thomas Huth
2019-10-19 14:00 ` Stefano Garzarella
2019-10-19 14:00 ` Stefano Garzarella
2019-10-21 16:28 ` Paolo Bonzini
2019-10-21 16:28 ` Paolo Bonzini
2019-10-21 16:29 ` Laurent Vivier
2019-10-21 16:29 ` Laurent Vivier
2019-10-21 16:35 ` Laurent Vivier
2019-10-21 16:35 ` Laurent Vivier
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=20191018131046.GG28271@redhat.com \
--to=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=kamil@netbsd.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=thuth@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.