My gut says the extensive additional code to flip to buffered mode merits
it's very own function (internal to apr would be fine, for now, but the
fact that we need to trigger it hints that others might want to too, in
some future 1.3.0 release.)
We can't return 0 bytes written, too many apps will presume 0 means file
closed, other signals tripped, error etc. We should do at least one
short-write before returning in either case.
Thoughts?
I can live with the proposed solution, though I think the case of
writing to consoles (and pipes?) is such an edge-case that it doesn't
really warrent the enormous code-complexity proposed. Especially
consoles are low-throughput devices anyway (making 2n+1 WriteFile
calls no real problem).
Again, I can live with the proposed solution.
bye,
Erik.