Add option to flush the entire buffer on -EOVERFLOW

This was the previous behavior prior to commit
fc3d70736e4c24cbdc8c91076013c01e487fd4d5.
The new behavior introduced by that commit is to preserve as much of the
buffer as possible.  But that introduced a regression in applications with
so many overflows that they can't recover.  So now the flush is optional.

Test: at bug
Bug: 36725187
Change-Id: Ia728a754405c89b5c46fea598f987ddb9e1e26d8
2 files changed