Added detail about why a file couldn't be opened (thanks mgerhardy!)
Fixes https://github.com/libsdl-org/SDL/issues/10484
(cherry picked from commit 1512013320)
This commit is contained in:
1 parent
4222cebef6
commit
07cfc34a2e
1 file changed
+2
-1
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIMITS_H
|
#ifdef HAVE_LIMITS_H
|
||||||
@@ -632,7 +633,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
|
|||||||
FILE *fp = fopen(file, mode);
|
FILE *fp = fopen(file, mode);
|
||||||
#endif
|
#endif
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
SDL_SetError("Couldn't open %s", file);
|
SDL_SetError("Couldn't open %s: %s", file, strerror(errno));
|
||||||
} else if (!IsRegularFileOrPipe(fp)) {
|
} else if (!IsRegularFileOrPipe(fp)) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
|||||||
Reference in new issue
Block a user