Adjust ftell for write buffer

This commit is contained in:
Jeremy Soller
2025-12-19 17:54:40 -07:00
parent ae509fd641
commit f3afff08de
+2
View File
@@ -784,7 +784,9 @@ pub unsafe extern "C" fn ftell_locked(stream: &mut FILE) -> off_t {
return -1;
}
// Adjust for read buffer, ungetc, and write buffer
pos - (stream.read_size - stream.read_pos) as off_t - stream.unget.len() as off_t
+ stream.writer.pending() as off_t
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/flockfile.html>.