From: Philippe Mathieu-Daudé Date: Fri, 28 Feb 2020 10:07:24 +0000 (+0100) Subject: util/osdep: Improve error report by calling error_setg_win32() X-Git-Tag: v5.0.0-rc0~50^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cf0c76cd6d6fc2f6e62160cd209bd0ed622bb83c;p=thirdparty%2Fqemu.git util/osdep: Improve error report by calling error_setg_win32() Use error_setg_win32() which adds a hint similar to strerror(errno)). Reviewed-by: Marc-André Lureau Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20200228100726.8414-3-philmd@redhat.com> Signed-off-by: Markus Armbruster --- diff --git a/util/osdep.c b/util/osdep.c index f7d06050f71..4829c07ff6e 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;