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]>
---
 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 1fd73312bab2..d7907c230656 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.543.g5ebe2ebe4ea8


Reply via email to