[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 13/14] qga/commands-win32: Use error_setg_win32() for better error messages
- To: Markus Armbruster <armbru@xxxxxxxxxx>
- From: Kostiantyn Kostiuk <kkostiuk@xxxxxxxxxx>
- Date: Fri, 21 Nov 2025 09:43:04 +0200
- Cc: qemu-devel@xxxxxxxxxx, arei.gonglei@xxxxxxxxxx, pizhenwei@xxxxxxxxxxxxx, alistair.francis@xxxxxxx, stefanb@xxxxxxxxxxxxxxxxxx, kwolf@xxxxxxxxxx, hreitz@xxxxxxxxxx, sw@xxxxxxxxxxx, qemu_oss@xxxxxxxxxxxxx, groug@xxxxxxxx, mst@xxxxxxxxxx, imammedo@xxxxxxxxxx, anisinha@xxxxxxxxxx, kraxel@xxxxxxxxxx, shentey@xxxxxxxxx, npiggin@xxxxxxxxx, harshpb@xxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, anthony@xxxxxxxxxxxxxx, paul@xxxxxxx, edgar.iglesias@xxxxxxxxx, elena.ufimtseva@xxxxxxxxxx, jag.raman@xxxxxxxxxx, sgarzare@xxxxxxxxxx, pbonzini@xxxxxxxxxx, fam@xxxxxxxxxx, philmd@xxxxxxxxxx, alex@xxxxxxxxxxx, clg@xxxxxxxxxx, peterx@xxxxxxxxxx, farosas@xxxxxxx, lizhijian@xxxxxxxxxxx, dave@xxxxxxxxxxx, jasowang@xxxxxxxxxx, samuel.thibault@xxxxxxxxxxxx, michael.roth@xxxxxxx, zhao1.liu@xxxxxxxxx, mtosatti@xxxxxxxxxx, rathc@xxxxxxxxxxxxx, palmer@xxxxxxxxxxx, liwei1518@xxxxxxxxx, dbarboza@xxxxxxxxxxxxxxxx, zhiwei_liu@xxxxxxxxxxxxxxxxx, marcandre.lureau@xxxxxxxxxx, qemu-block@xxxxxxxxxx, qemu-ppc@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, qemu-riscv@xxxxxxxxxx
- Delivery-date: Fri, 21 Nov 2025 07:46:59 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
We include numeric GetLastError() codes in error messages in a few
places, like this:
error_setg(errp, "GRIPE: %d", (int)GetLastError());
Show text instead, like this:
error_setg_win32(errp, GetLastError(), "GRIPE");
Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>
---
qga/commands-win32.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index acc2c11589..0fd0c966e4 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -1798,8 +1798,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
tf.dwHighDateTime = (DWORD) (time >> 32);
if (!FileTimeToSystemTime(&tf, &ts)) {
- error_setg(errp, "Failed to convert system time %d",
- (int)GetLastError());
+ error_setg_win32(errp, GetLastError(),
+ "Failed to convert system time");
return;
}
@@ -1810,7 +1810,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
}
if (!SetSystemTime(&ts)) {
- error_setg(errp, "Failed to set time to guest: %d", (int)GetLastError());
+ error_setg_win32(errp, GetLastError(),
+ "Failed to set time to guest");
return;
}
}
@@ -1834,13 +1835,12 @@ GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp)
(length > sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION))) {
ptr = pslpi = g_malloc0(length);
if (GetLogicalProcessorInformation(pslpi, &length) == FALSE) {
- error_setg(&local_err, "Failed to get processor information: %d",
- (int)GetLastError());
+ error_setg_win32(&local_err, GetLastError(),
+ "Failed to get processor information");
}
} else {
- error_setg(&local_err,
- "Failed to get processor information buffer length: %d",
- (int)GetLastError());
+ error_setg_win32(&local_err, GetLastError(),
+ "Failed to get processor information buffer length");
}
while ((local_err == NULL) && (length > 0)) {
--
2.49.0
|