Commit c63f672ee5 for qemu.org

commit c63f672ee57075463e5b96aaa3edc8f445bf924e
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date:   Mon Sep 7 14:50:10 2026 +0400

    qga/vss-win32: evaluate err_set() macro argument only once

    The err_set macro expands its 'err' parameter three times. When
    callers pass GetLastError(), the Win32 error code is fetched on
    each expansion and may change between evaluations, since the
    intervening function calls can reset the thread's last-error value.

    Capture the argument in a local DWORD once and reference that
    throughout the macro body.

    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-12-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 d7907c2306..e3a15f83bf 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -27,10 +27,11 @@
 #define DEFAULT_VSS_BACKUP_TYPE VSS_BT_FULL

 #define err_set(e, err, fmt, ...) {                                         \
+    DWORD _e = (DWORD)(err);                                                \
     (e)->error_setg_win32_wrapper((e)->errp, __FILE__, __LINE__, __func__,  \
-                                   err, fmt ": Windows error 0x%lx",        \
-                                   ## __VA_ARGS__, err);                    \
-    qga_debug(fmt ": Windows error 0x%lx", ## __VA_ARGS__, err);            \
+                                   _e, fmt ": Windows error 0x%lx",         \
+                                   ## __VA_ARGS__, _e);                     \
+    qga_debug(fmt ": Windows error 0x%lx", ## __VA_ARGS__, _e);             \
 }
 /* Bad idea, works only when (e)->errp != NULL: */
 #define err_is_set(e) ((e)->errp && *(e)->errp)