mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-30 12:25:49 +00:00
On Windows the UCRT drops a write that directly follows a read on an r+, w+ or a+ stream: fputc and fprintf report success, fwrite returns 0 and fputs returns EOF, all without the error indicator, and the file is left unchanged, also after an fflush. On a stream open only for reading, fputc after a read reports success as well. Writes now first do what FreeBSD 11.4's __swsetup does: a stream open only for reading fails with EBADF and sets the error indicator, and an update stream that is reading drops its read buffer and ungetc data, clears end of file and writes at the descriptor's offset. This covers fwrite, fputs, fputc, putc_unlocked, fprintf, fprintf_s, fputwc, fputws, fwprintf, fwprintf_s, puts and wprintf, and printf, vprintf and printf_s, which write to standard output through PrintWindows and now return -1 there instead of throwing. Linux is unchanged: glibc writes at the stream position, which the libc technical debt now records.