]> git.proxmox.com Git - mirror_qemu.git/commitdiff
util/osdep: Improve error report by calling error_setg_win32()
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Fri, 28 Feb 2020 10:07:24 +0000 (11:07 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 9 Mar 2020 12:36:15 +0000 (13:36 +0100)
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>
util/osdep.c

index f7d06050f712a154c12df07a25083611f924f63e..4829c07ff6edbb1508946ad789031f51b2cb6035 100644 (file)
@@ -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;