Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rwops don't have the details on the opening error available for stdio mode. #10484

Closed
mgerhardy opened this issue Aug 6, 2024 · 1 comment
Closed

Comments

@mgerhardy
Copy link
Contributor

Maybe something like this would work?

diff --git a/contrib/libs/sdl2/src/file/SDL_rwops.c b/contrib/libs/sdl2/src/file/SDL_rwops.c
index bf47ba711..444bf4af3 100644
--- a/contrib/libs/sdl2/src/file/SDL_rwops.c
+++ b/contrib/libs/sdl2/src/file/SDL_rwops.c
@@ -36,6 +36,7 @@
 
 #ifdef HAVE_STDIO_H
 #include <stdio.h>
+#include <errno.h>
 #include <sys/stat.h>
 #endif
 #ifdef HAVE_LIMITS_H
@@ -632,7 +633,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
         FILE *fp = fopen(file, mode);
 #endif
         if (!fp) {
-            SDL_SetError("Couldn't open %s", file);
+            SDL_SetError("Couldn't open %s: %s", file, strerror(errno));
         } else if (!IsRegularFileOrPipe(fp)) {
             fclose(fp);
             fp = NULL;
@slouken
Copy link
Collaborator

slouken commented Aug 6, 2024

Looks good, thanks!

slouken added a commit that referenced this issue Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants