Only log fd warning if there's a file getting closed (#2737)

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();
}