From f6cc245e4019d1e2f3dfc435f27197ee1c2874a3 Mon Sep 17 00:00:00 2001 From: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com> Date: Tue, 1 Apr 2025 15:36:31 -0500 Subject: [PATCH] Only log fd warning if there's a file getting closed (#2737) --- src/core/libraries/kernel/file_system.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/libraries/kernel/file_system.cpp b/src/core/libraries/kernel/file_system.cpp index 3321559ed..bc34dff98 100644 --- a/src/core/libraries/kernel/file_system.cpp +++ b/src/core/libraries/kernel/file_system.cpp @@ -190,16 +190,16 @@ s32 PS4_SYSV_ABI sceKernelOpen(const char* path, s32 flags, /* SceKernelMode*/ u } s32 PS4_SYSV_ABI close(s32 fd) { - if (fd < 3) { - // This is technically possible, but it's usually caused by some stubbed function instead. - LOG_WARNING(Kernel_Fs, "called on an std handle, fd = {}", fd); - } auto* h = Common::Singleton::Instance(); auto* file = h->GetFile(fd); if (file == nullptr) { *__Error() = POSIX_EBADF; return -1; } + if (fd < 3) { + // This is technically possible, but it's usually caused by some stubbed function instead. + LOG_WARNING(Kernel_Fs, "called on an std handle, fd = {}", fd); + } if (file->type == Core::FileSys::FileType::Regular) { file->f.Close(); }