Commit 0d81153339 for qemu.org
commit 0d811533398fa7cb221c8df74fed62e3a42a1f20
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Mon Sep 7 14:50:07 2026 +0400
qga/vss-win32: use GetLastError() after FindFirstVolumeW failure
When FindFirstVolumeW fails, the error was reported using a stale
HRESULT from a prior SetContext call instead of the actual Windows
error. Use GetLastError() to report the correct failure reason.
Fixes: 0692b03ee135 ("qga-win: add support for qmp_guest_fsfreeze_freeze_list")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260907-qga-v1-9-86456ad356e2@redhat.com
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index 1fd73312ba..d7907c2306 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -434,7 +434,7 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
if (!mountpoints) {
volume = FindFirstVolumeW(short_volume_name, ARRAYSIZE(short_volume_name));
if (volume == INVALID_HANDLE_VALUE) {
- err_set(errset, hr, "failed to find first volume");
+ err_set(errset, GetLastError(), "failed to find first volume");
goto out;
}