fflush: Add test for buffer handling in __sflush
Sponsored by: Klara, Inc.
(cherry picked from commit b8dbfb0a6c181a9aeab0b793deb0813d06052df9)
(cherry picked from commit ba490dfc95e0941216420a2003757b3c4b5b2ec2)
(cherry picked from commit 66d84f1362f63c23f6f451490e153e0703a7cda6)
Approved by: so