From: Marc-AndrĂ© Lureau <[email protected]>

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 <[email protected]>
Reviewed-by: Kostiantyn Kostiuk <[email protected]>
Link: 
https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
---
 qga/vss-win32/requester.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
         }
 
-- 
2.55.0


Reply via email to