From e5fa9292459a769f3d91997bc21114d0c1a5278d Mon Sep 17 00:00:00 2001
From: Kyle Sylvestre <[EMAIL REDACTED]>
Date: Tue, 15 Oct 2024 22:47:06 -0400
Subject: [PATCH] Report win32 last error string windows_file_open (#11224)
---
src/file/SDL_iostream.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/file/SDL_iostream.c b/src/file/SDL_iostream.c
index 8fde6dcf9ec81..1fa652f89310d 100644
--- a/src/file/SDL_iostream.c
+++ b/src/file/SDL_iostream.c
@@ -133,7 +133,13 @@ static HANDLE SDLCALL windows_file_open(const char *filename, const char *mode)
#endif
if (h == INVALID_HANDLE_VALUE) {
- SDL_SetError("Couldn't open %s", filename);
+ char *error;
+ if (SDL_asprintf(&error, "Couldn't open %s", filename) > 0) {
+ WIN_SetError(error);
+ SDL_free(error);
+ } else {
+ SDL_SetError("Couldn't open %s", filename);
+ }
}
return h;
}