[libcxx-commits] [libcxx] [libc++] Fix filebuf resetting its underlying buffer upon close() (PR #168947)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 21 03:22:46 PST 2025
================
@@ -778,7 +778,12 @@ basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::close() {
if (fclose(__h.release()))
__rt = nullptr;
__file_ = nullptr;
- setbuf(0, 0);
+ // Reset the get and the put areas without nonetheless getting rid of the
+ // underlying buffers, which might have been configured by the user who might
+ // reopen the stream.
----------------
philnik777 wrote:
```suggestion
// Reset the get and the put areas without getting rid of the
// underlying buffers, which might have been configured by the user.
// Make sure to keep the buffer, since the user may re-open the stream.
```
I think is what you wanted to say?
https://github.com/llvm/llvm-project/pull/168947
More information about the libcxx-commits
mailing list