mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 16:43:05 -05:00
fopen opened its stream with _wfopen, which shares read and write access but not delete access. While the guest held a stream open, rename of its file failed with EIO and remove with EBUSY. POSIX rename and remove work on open files, as on Linux and FreeBSD, and since #3677 the descriptors sceKernelOpen returns share delete access. fopen now creates the handle with CreateFileW sharing read, write and delete, with the access and creation disposition of the mode, and wraps it with _open_osfhandle and _wfdopen, keeping append mode. A failed CreateFileW sets errno through the error mapping #3677 added to libkernel's NativeOpen, which moves to libc as WindowsOpenError_nid_no_patch so that both use it. freopen still reopens through _wfreopen; TechnicalDebt records it.