SDL: SDL_EnumerateDirectory(): (posix) Fix return value when directory is invalid

From 8468c372b21b937d7adb340c4725d77c7d87c4d9 Mon Sep 17 00:00:00 2001
From: Petar Popovic <[EMAIL REDACTED]>
Date: Sat, 26 Oct 2024 07:13:00 +0200
Subject: [PATCH] SDL_EnumerateDirectory(): (posix) Fix return value when
 directory is invalid

---
 src/filesystem/posix/SDL_sysfsops.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/filesystem/posix/SDL_sysfsops.c b/src/filesystem/posix/SDL_sysfsops.c
index 36f539257d64a..463bbb56897e9 100644
--- a/src/filesystem/posix/SDL_sysfsops.c
+++ b/src/filesystem/posix/SDL_sysfsops.c
@@ -40,8 +40,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_Enume
 
     DIR *dir = opendir(path);
     if (!dir) {
-        SDL_SetError("Can't open directory: %s", strerror(errno));
-        return -1;
+        return SDL_SetError("Can't open directory: %s", strerror(errno));
     }
 
     struct dirent *ent;