libc: fopen of a directory in a write mode fails with EACCES instead of EISDIR on Windows #8191

Closed
opened 2026-10-20 02:02:50 +00:00 by xXPBSXx · 0 comments
xXPBSXx commented 2026-10-20 02:02:50 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T02:02:50Z.


Repro

Windows host. fopen("somedir", "w") (also "wb", "r+", "a") and the same through freopen.
Expected (FreeBSD 11.4 vn_open_vnode, sys/kern/vfs_vnops.c:318-320): EISDIR (21).
Actual: EACCES (13), the host CRT's answer. Linux hosts already report EISDIR (core/libs/tests/GuestFopenErrors.cpp, Linux only).
Test: core/libs/tests/GuestFilesystem.cpp (new cases; fail before the fix).
Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/fopen-directory-write-fb
AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5934622033 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8191). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-20T02:02:50Z. --- ### Repro Windows host. `fopen("somedir", "w")` (also "wb", "r+", "a") and the same through `freopen`. Expected (FreeBSD 11.4 `vn_open_vnode`, sys/kern/vfs_vnops.c:318-320): EISDIR (21). Actual: EACCES (13), the host CRT's answer. Linux hosts already report EISDIR (core/libs/tests/GuestFopenErrors.cpp, Linux only). Test: `core/libs/tests/GuestFilesystem.cpp` (new cases; fail before the fix). Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/fopen-directory-write-fb AI-assisted (Claude Code).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#8191
No description provided.