fix(libkernel): return EBADF from sceKernelClose for a descriptor that is not open #1222
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1222"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-07T18:14:19Z.
What
sceKernelClosethrewstd::runtime_errorwhenever the host close failed, so a title that closes a descriptor that is not open terminated the process. PPSA09706 (Persona 5 Tactica, Unity IL2CPP) closes descriptor 0 more than once: the first close succeeds, the next ones fail withsceKernelClose: close failed, fd=0, errno=9and the title aborted about five seconds after start-up.sceKernelClosenow returnsSCE_KERNEL_ERROR_EBADFwhen the descriptor is not open, and the title ignores the result as it does on a console. Any other close failure still throws.On Windows the host
_closeruns with a thread-local no-op invalid-parameter handler. The UCRT dispatches an invalid-parameter report for a bad descriptor, and the crash reporter answers it with a backtrace of every thread, which is noise for a close that is reported to the title as an ordinary error.Tested
guest_filesystempasses with the new checks (closing a descriptor twice and closing -1 both return0x80020009).tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); no silent stubs added.mdfiles or images added to the repository