aboutsummaryrefslogtreecommitdiff
path: root/qga/commands-win32.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-05-27 06:40:42 -0700
committerRichard Henderson <richard.henderson@linaro.org>2024-05-27 06:40:42 -0700
commitad10b4badc1dd5b28305f9b9f1168cf0aa3ae946 (patch)
tree9e08aba8fac73dee0995c38b6f0d44bf4be04a88 /qga/commands-win32.c
parent60b54b67c63d8f076152e0f7dccf39854dfc6a77 (diff)
parent2020337239b054447d0756ea75e970b35f7a541b (diff)
Merge tag 'pull-error-2024-05-27' of https://repo.or.cz/qemu/armbru into staging
Error reporting patches for 2024-05-27 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmZUaB8SHGFybWJydUBy # ZWRoYXQuY29tAAoJEDhwtADrkYZTnY0P/jr94u+NI8+Jykh8d/i5gz70dLS6F3oM # PstnO9HXByCKeRRmTWesPnzd1idq9ZNnXTmZbriAv6sGduEBfOLyXmMLHj0L10EA # tDrmFHQOS+9NcCeJ08SFRIgcxt6X9lUjGsoGXLxAfBZiWMsK18lXl5tTNGCtLQU5 # D1lc7byRHdVg+EzfhFqF6nU7UW63vNqtcwBElk1xc2zsU2yqX4pIvImTyRzUGC7h # 8au68s3agFP/c98jgpljdI/V5TkgxAPa3OqkFXAjM9SLGi8szRxgLuMaufcOn5XQ # F4/89GdhdvLGNFvpeBJyTud3NC0V2vDf7F4HABayHE8azYAu8/7H22SI+lvhnZi4 # m6yb2vP/x9+EVZxPoeT1TIY3N7W5wDJg8aIHCrLPtJXgnsBGTzEK6VydCeIjEl8Z # Ai6WioKSFP6JhMT2a/6hAtceS2AWRnHhGx+BpaWYsr1FBWqJa4hgC+1IJWX3NI4G # urmELw1B2RCOKB7jFusYNnKu67sVkT/eaxj+LcBwEi4XEddpCurqhi32SlpEJzcK # JxQ/swGDD9hdx8Y5WPuRnUkPsvJO2uOJc50VSlDkdHg3ZCEgEhHuENOOvXjxtT5I # nsgZEDRiUgn42AhhiFwulYUWt2dT/K974ZebEer305ajYaseilUQclATNlRNNVlV # t16ViC6cIdCN # =tAQ+ # -----END PGP SIGNATURE----- # gpg: Signature made Mon 27 May 2024 04:01:51 AM PDT # 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] * tag 'pull-error-2024-05-27' of https://repo.or.cz/qemu/armbru: qerror: QERR_QGA_COMMAND_FAILED is no longer used, drop qga: Shorten several error messages qga-win32: Improve guest-set-user-password, guest-file-open errors qerror: QERR_IO_ERROR is no longer used, drop migration: Rephrase message on failure to save / load Xen device state cpus: Improve error messages on memsave, pmemsave write error block/vmdk: Improve error messages on extent write error dump/win_dump: Improve error messages on write error block: Improve error message when external snapshot can't flush Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'qga/commands-win32.c')
-rw-r--r--qga/commands-win32.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 6fee0e1e6f..0d1b836e87 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -217,6 +217,9 @@ int64_t qmp_guest_file_open(const char *path, const char *mode, Error **errp)
w_path = g_utf8_to_utf16(path, -1, NULL, NULL, &gerr);
if (!w_path) {
+ error_setg(errp, "can't convert 'path' to UTF-16: %s",
+ gerr->message);
+ g_error_free(gerr);
goto done;
}
@@ -244,10 +247,6 @@ int64_t qmp_guest_file_open(const char *path, const char *mode, Error **errp)
slog("guest-file-open, handle: % " PRId64, fd);
done:
- if (gerr) {
- error_setg(errp, QERR_QGA_COMMAND_FAILED, gerr->message);
- g_error_free(gerr);
- }
g_free(w_path);
return fd;
}
@@ -279,8 +278,7 @@ static void acquire_privilege(const char *name, Error **errp)
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token))
{
if (!LookupPrivilegeValue(NULL, name, &priv.Privileges[0].Luid)) {
- error_setg(errp, QERR_QGA_COMMAND_FAILED,
- "no luid for requested privilege");
+ error_setg(errp, "no luid for requested privilege");
goto out;
}
@@ -288,14 +286,12 @@ static void acquire_privilege(const char *name, Error **errp)
priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if (!AdjustTokenPrivileges(token, FALSE, &priv, 0, NULL, 0)) {
- error_setg(errp, QERR_QGA_COMMAND_FAILED,
- "unable to acquire requested privilege");
+ error_setg(errp, "unable to acquire requested privilege");
goto out;
}
} else {
- error_setg(errp, QERR_QGA_COMMAND_FAILED,
- "failed to open privilege token");
+ error_setg(errp, "failed to open privilege token");
}
out:
@@ -309,8 +305,7 @@ static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque,
{
HANDLE thread = CreateThread(NULL, 0, func, opaque, 0, NULL);
if (!thread) {
- error_setg(errp, QERR_QGA_COMMAND_FAILED,
- "failed to dispatch asynchronous command");
+ error_setg(errp, "failed to dispatch asynchronous command");
}
}
@@ -1419,22 +1414,19 @@ static void check_suspend_mode(GuestSuspendMode mode, Error **errp)
ZeroMemory(&sys_pwr_caps, sizeof(sys_pwr_caps));
if (!GetPwrCapabilities(&sys_pwr_caps)) {
- error_setg(errp, QERR_QGA_COMMAND_FAILED,
- "failed to determine guest suspend capabilities");
+ error_setg(errp, "failed to determine guest suspend capabilities");
return;
}
switch (mode) {
case GUEST_SUSPEND_MODE_DISK:
if (!sys_pwr_caps.SystemS4) {
- error_setg(errp, QERR_QGA_COMMAND_FAILED,
- "suspend-to-disk not supported by OS");
+ error_setg(errp, "suspend-to-disk not supported by OS");
}
break;
case GUEST_SUSPEND_MODE_RAM:
if (!sys_pwr_caps.SystemS3) {
- error_setg(errp, QERR_QGA_COMMAND_FAILED,
- "suspend-to-ram not supported by OS");
+ error_setg(errp, "suspend-to-ram not supported by OS");
}
break;
default:
@@ -1946,11 +1938,17 @@ void qmp_guest_set_user_password(const char *username,
user = g_utf8_to_utf16(username, -1, NULL, NULL, &gerr);
if (!user) {
+ error_setg(errp, "can't convert 'username' to UTF-16: %s",
+ gerr->message);
+ g_error_free(gerr);
goto done;
}
wpass = g_utf8_to_utf16(rawpasswddata, -1, NULL, NULL, &gerr);
if (!wpass) {
+ error_setg(errp, "can't convert 'password' to UTF-16: %s",
+ gerr->message);
+ g_error_free(gerr);
goto done;
}
@@ -1966,10 +1964,6 @@ void qmp_guest_set_user_password(const char *username,
}
done:
- if (gerr) {
- error_setg(errp, QERR_QGA_COMMAND_FAILED, gerr->message);
- g_error_free(gerr);
- }
g_free(user);
g_free(wpass);
g_free(rawpasswddata);
@@ -2174,8 +2168,7 @@ static void ga_get_win_version(RTL_OSVERSIONINFOEXW *info, Error **errp)
HMODULE module = GetModuleHandle("ntdll");
PVOID fun = GetProcAddress(module, "RtlGetVersion");
if (fun == NULL) {
- error_setg(errp, QERR_QGA_COMMAND_FAILED,
- "Failed to get address of RtlGetVersion");
+ error_setg(errp, "Failed to get address of RtlGetVersion");
return;
}