diff options
author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2020-02-28 11:07:25 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-03-09 13:36:15 +0100 |
commit | 672db77892d367f1dc3797571511acce27597a11 (patch) | |
tree | 05ffa465723e65bd11a7ad462b36b8e305317e2f /qga/commands-win32.c | |
parent | cf0c76cd6d6fc2f6e62160cd209bd0ed622bb83c (diff) |
qga: Improve error report by calling error_setg_win32()
Use error_setg_win32() which adds a hint similar to strerror(errno)).
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200228100726.8414-4-philmd@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'qga/commands-win32.c')
-rw-r--r-- | qga/commands-win32.c | 8 |
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); |