From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: qemu-devel@nongnu.org,
"Daniel P . Berrange" <berrange@redhat.com>,
qemu-trivial@nongnu.org, "Stefan Weil" <sw@weilnetz.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH 2/2] util/oslib-win32: Improve error report by calling error_setg_win32()
Date: Thu, 27 Feb 2020 15:42:52 +0100 [thread overview]
Message-ID: <87zhd4ozv7.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20200227100250.20514-3-philmd@redhat.com> ("Philippe Mathieu-Daudé"'s message of "Thu, 27 Feb 2020 11:02:50 +0100")
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> Use error_setg_win32() which adds a hint similar to strerror(errno)).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> util/oslib-win32.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/util/oslib-win32.c b/util/oslib-win32.c
> index e9b14ab178..d2fca1808d 100644
> --- a/util/oslib-win32.c
> +++ b/util/oslib-win32.c
> @@ -46,7 +46,8 @@
> void *qemu_oom_check(void *ptr)
> {
> if (ptr == NULL) {
> - fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError());
> + g_autofree gchar *emsg = g_win32_error_message(GetLastError());
Since we're on a path to abort(), I wouldn't bother with g_autofree.
> + fprintf(stderr, "Failed to allocate memory: %s\n", emsg);
Any particular reason not to use error_report()?
> abort();
> }
> return ptr;
WARNING: multiple messages have this Message-ID (diff)
From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Daniel P . Berrange" <berrange@redhat.com>,
qemu-trivial@nongnu.org, "Stefan Weil" <sw@weilnetz.de>,
qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH 2/2] util/oslib-win32: Improve error report by calling error_setg_win32()
Date: Thu, 27 Feb 2020 15:42:52 +0100 [thread overview]
Message-ID: <87zhd4ozv7.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20200227100250.20514-3-philmd@redhat.com> ("Philippe Mathieu-Daudé"'s message of "Thu, 27 Feb 2020 11:02:50 +0100")
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> Use error_setg_win32() which adds a hint similar to strerror(errno)).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> util/oslib-win32.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/util/oslib-win32.c b/util/oslib-win32.c
> index e9b14ab178..d2fca1808d 100644
> --- a/util/oslib-win32.c
> +++ b/util/oslib-win32.c
> @@ -46,7 +46,8 @@
> void *qemu_oom_check(void *ptr)
> {
> if (ptr == NULL) {
> - fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError());
> + g_autofree gchar *emsg = g_win32_error_message(GetLastError());
Since we're on a path to abort(), I wouldn't bother with g_autofree.
> + fprintf(stderr, "Failed to allocate memory: %s\n", emsg);
Any particular reason not to use error_report()?
> abort();
> }
> return ptr;
next prev parent reply other threads:[~2020-02-27 14:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-27 10:02 [PATCH 0/2] misc: Improve error reporting on Windows Philippe Mathieu-Daudé
2020-02-27 10:02 ` Philippe Mathieu-Daudé
2020-02-27 10:02 ` [PATCH 1/2] chardev: Improve error report by calling error_setg_win32() Philippe Mathieu-Daudé
2020-02-27 10:02 ` Philippe Mathieu-Daudé
2020-02-27 10:23 ` Daniel P. Berrangé
2020-02-27 10:23 ` Daniel P. Berrangé
2020-02-27 10:27 ` Marc-André Lureau
2020-02-27 10:27 ` Marc-André Lureau
2020-02-27 10:02 ` [PATCH 2/2] util/oslib-win32: " Philippe Mathieu-Daudé
2020-02-27 10:02 ` Philippe Mathieu-Daudé
2020-02-27 10:21 ` Daniel P. Berrangé
2020-02-27 10:21 ` Daniel P. Berrangé
2020-02-27 14:42 ` Markus Armbruster [this message]
2020-02-27 14:42 ` Markus Armbruster
2020-02-27 15:35 ` Philippe Mathieu-Daudé
2020-02-27 15:35 ` Philippe Mathieu-Daudé
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=87zhd4ozv7.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=sw@weilnetz.de \
/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.