diff --git a/src/file/SDL_iostream.c b/src/file/SDL_iostream.c index ef1d21d240..d10de2da79 100644 --- a/src/file/SDL_iostream.c +++ b/src/file/SDL_iostream.c @@ -26,6 +26,7 @@ #ifdef HAVE_STDIO_H #include +#include #include #endif #ifdef HAVE_LIMITS_H @@ -565,7 +566,7 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode) FILE *fp = fdopen(fd, mode); if (!fp) { close(fd); - SDL_SetError("Unable to open file descriptor (%d) from URI %s", fd, file); + SDL_SetError("Unable to open file descriptor (%d) from URI %s: %s", fd, file, strerror(errno)); return NULL; } @@ -655,7 +656,7 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *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;