Only log fd warning if there's a file getting closed (#2737)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions

This commit is contained in:
Stephen Miller 2025-04-01 15:36:31 -05:00 committed by GitHub
parent 9ee5d066a2
commit f6cc245e40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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<Core::FileSys::HandleTable>::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();
}