fix(stdio): correct position tracking on mode switch and free owned buffers on close

This commit is contained in:
2026-09-04 23:42:03 -04:00
parent 22587bd545
commit 34408380f0
4 changed files with 137 additions and 8 deletions
+7 -1
View File
@@ -206,7 +206,13 @@ fseeko(FILE *stream, off_t offset, int whence);
long
ftell(FILE *stream);
__attribute__((pure)) off_t
/*
* Not marked pure: the implementation can allocate the stream buffer on
* first use (an observable side effect), so the compiler must not elide
* or reorder the call. (feof/ferror/fileno below are genuinely read-only
* and keep their pure attribute.)
*/
off_t
ftello(FILE *stream);
/* Rewind to the start and clear feof/ferror (equivalent to