]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
block/file-win32: Improve an error message
authorMarkus Armbruster <armbru@redhat.com>
Fri, 21 Nov 2025 12:14:38 +0000 (13:14 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 8 Jan 2026 06:50:32 +0000 (07:50 +0100)
Two out of three calls of CreateFile() use error_setg_win32() to
report errors.  The third uses error_setg_errno(), mapping
ERROR_ACCESS_DENIED to EACCES, and everything else to EINVAL, throwing
away detail.  Switch it to error_setg_win32().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20251121121438.1249498-16-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
block/file-win32.c

index b00039bf9458d135bedc175436bf7c537ca923cf..b63ce1c189d31ef9c5d843e9deb4e6a02649a114 100644 (file)
@@ -872,7 +872,7 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
         } else {
             ret = -EINVAL;
         }
-        error_setg_errno(errp, -ret, "Could not open device");
+        error_setg_win32(errp, err, "Could not open device");
         goto done;
     }