qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	"Michael Roth" <mdroth@linux.vnet.ibm.com>,
	"Stefan Weil" <sw@weilnetz.de>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Tomáš Golembiovský" <tgolembi@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH v2 4/6] util/osdep: Improve error report by calling error_setg_win32()
Date: Thu, 27 Feb 2020 18:22:30 +0100	[thread overview]
Message-ID: <CAMxuvayLYP--wLfFr2G9fjNUw8xxRSycYPGNgOfJa6a3VvJbcg@mail.gmail.com> (raw)
In-Reply-To: <20200227163101.414-5-philmd@redhat.com>

On Thu, Feb 27, 2020 at 5:32 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> Use error_setg_win32() which adds a hint similar to strerror(errno)).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  util/osdep.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/util/osdep.c b/util/osdep.c
> index ef40ae512a..144e217cb9 100644
> --- a/util/osdep.c
> +++ b/util/osdep.c
> @@ -82,8 +82,8 @@ static int qemu_mprotect__osdep(void *addr, size_t size, int prot)
>      DWORD old_protect;
>
>      if (!VirtualProtect(addr, size, prot, &old_protect)) {
> -        error_report("%s: VirtualProtect failed with error code %ld",
> -                     __func__, GetLastError());
> +        g_autofree gchar *emsg = g_win32_error_message(GetLastError());
> +        error_report("%s: VirtualProtect failed: %s", __func__, emsg);
>          return -1;
>      }
>      return 0;
> @@ -506,12 +506,12 @@ int socket_init(void)
>  {
>  #ifdef _WIN32
>      WSADATA Data;
> -    int ret, err;
> +    int ret;
>
>      ret = WSAStartup(MAKEWORD(2, 2), &Data);
>      if (ret != 0) {
> -        err = WSAGetLastError();
> -        error_report("WSAStartup: %d", err);
> +        g_autofree gchar *emsg = g_win32_error_message(WSAGetLastError());
> +        error_report("WSAStartup: %s", emsg);
>          return -1;
>      }
>      atexit(socket_cleanup);
> --
> 2.21.1
>



  reply	other threads:[~2020-02-27 17:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 16:30 [PATCH v2 0/6] misc: Improve error reporting on Windows Philippe Mathieu-Daudé
2020-02-27 16:30 ` [PATCH v2 1/6] chardev: Improve error report by calling error_setg_win32() Philippe Mathieu-Daudé
2020-02-27 16:30 ` [PATCH v2 2/6] util: Replace fprintf(stderr, "*\n" with error_report() Philippe Mathieu-Daudé
2020-02-28  7:43   ` Markus Armbruster
2020-02-28  9:50     ` Philippe Mathieu-Daudé
2020-02-28  9:57       ` Philippe Mathieu-Daudé
2020-02-28 17:41         ` Markus Armbruster
2020-02-27 16:30 ` [PATCH v2 3/6] util/oslib-win32: Improve error report by calling error_setg_win32() Philippe Mathieu-Daudé
2020-02-27 16:30 ` [PATCH v2 4/6] util/osdep: " Philippe Mathieu-Daudé
2020-02-27 17:22   ` Marc-André Lureau [this message]
2020-02-27 16:31 ` [PATCH v2 5/6] qga: Fix a memory leak Philippe Mathieu-Daudé
2020-02-27 17:21   ` Marc-André Lureau
2020-02-27 16:31 ` [PATCH v2 6/6] qga: Improve error report by calling error_setg_win32() Philippe Mathieu-Daudé
2020-02-27 17:20   ` Marc-André Lureau
2020-02-27 17:34     ` 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=CAMxuvayLYP--wLfFr2G9fjNUw8xxRSycYPGNgOfJa6a3VvJbcg@mail.gmail.com \
    --to=marcandre.lureau@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=sw@weilnetz.de \
    --cc=tgolembi@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 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).