diff mbox series

[v2,3/6] util/oslib-win32: Improve error report by calling error_setg_win32()

Message ID 20200227163101.414-4-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series misc: Improve error reporting on Windows | expand

Commit Message

Philippe Mathieu-Daudé Feb. 27, 2020, 4:30 p.m. UTC
Use error_setg_win32() which adds a hint similar to strerror(errno)).

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 util/oslib-win32.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 84b937865a..6a3e6174f6 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -47,7 +47,8 @@ 
 void *qemu_oom_check(void *ptr)
 {
     if (ptr == NULL) {
-        error_report("Failed to allocate memory: %lu", GetLastError());
+        g_autofree gchar *emsg = g_win32_error_message(GetLastError());
+        error_report("Failed to allocate memory: %s", emsg);
         abort();
     }
     return ptr;