qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] util/oslib-win32: Improve error report by calling error_setg


From: Philippe Mathieu-Daudé
Subject: [PATCH 2/2] util/oslib-win32: Improve error report by calling error_setg_win32()
Date: Thu, 27 Feb 2020 11:02:50 +0100

Use error_setg_win32() which adds a hint similar to strerror(errno)).

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 util/oslib-win32.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index e9b14ab178..d2fca1808d 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -46,7 +46,8 @@
 void *qemu_oom_check(void *ptr)
 {
     if (ptr == NULL) {
-        fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError());
+        g_autofree gchar *emsg = g_win32_error_message(GetLastError());
+        fprintf(stderr, "Failed to allocate memory: %s\n", emsg);
         abort();
     }
     return ptr;
-- 
2.21.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]