Skip to content

Commit

Permalink
util/osdep: Improve error report by calling error_setg_win32()
Browse files Browse the repository at this point in the history
Use error_setg_win32() which adds a hint similar to strerror(errno)).

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200228100726.8414-3-philmd@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
  • Loading branch information
philmd authored and Markus Armbruster committed Mar 9, 2020
1 parent 4c23519 commit cf0c76c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util/osdep.c
Expand Up @@ -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;
Expand Down

0 comments on commit cf0c76c

Please sign in to comment.