summary refs log tree commit diff stats
path: root/qga/commands-win32.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-03-09 13:51:14 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-03-09 13:51:14 +0000
commitdee65a00d1e6c255c9c888e47a692803d60dc6ca (patch)
tree8e425557553125d5417687742fedb455fde23c5a /qga/commands-win32.c
parent7a5853cec479a448edae0fb2aaf4e2f78c9c774d (diff)
parentd1eddab86f92e7e060c8a473695c7f24ec00c9ab (diff)
downloadfocaccia-qemu-dee65a00d1e6c255c9c888e47a692803d60dc6ca.tar.gz
focaccia-qemu-dee65a00d1e6c255c9c888e47a692803d60dc6ca.zip
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2020-03-09' into staging
Error reporting patches for 2020-03-09

# gpg: Signature made Mon 09 Mar 2020 12:37:04 GMT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-error-2020-03-09:
  qga: Fix a memory leak
  qga: Improve error report by calling error_setg_win32()
  util/osdep: Improve error report by calling error_setg_win32()
  chardev: Improve error report by calling error_setg_win32()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qga/commands-win32.c')
-rw-r--r--qga/commands-win32.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 2461fd19bf..9c744d6405 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -315,8 +315,9 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
     }
 
     if (!ExitWindowsEx(shutdown_flag, SHTDN_REASON_FLAG_PLANNED)) {
-        slog("guest-shutdown failed: %lu", GetLastError());
-        error_setg(errp, QERR_UNDEFINED_ERROR);
+        g_autofree gchar *emsg = g_win32_error_message(GetLastError());
+        slog("guest-shutdown failed: %s", emsg);
+        error_setg_win32(errp, GetLastError(), "guest-shutdown failed");
     }
 }
 
@@ -1319,7 +1320,8 @@ static DWORD WINAPI do_suspend(LPVOID opaque)
     DWORD ret = 0;
 
     if (!SetSuspendState(*mode == GUEST_SUSPEND_MODE_DISK, TRUE, TRUE)) {
-        slog("failed to suspend guest, %lu", GetLastError());
+        g_autofree gchar *emsg = g_win32_error_message(GetLastError());
+        slog("failed to suspend guest: %s", emsg);
         ret = -1;
     }
     g_free(mode);