Re: [PATCH 1/1] vreportf(): avoid buffered write in favor of unbuffered one
From: Johannes Schindelin <hidden>
Date: 2019-10-29 14:18:44
From: Johannes Schindelin <hidden>
Date: 2019-10-29 14:18:44
Hi Peff, On Tue, 29 Oct 2019, Jeff King wrote:
On Tue, Oct 29, 2019 at 01:38:49PM +0100, Johannes Schindelin wrote:quoted
quoted
quoted
Let's avoid this predicament altogether by rendering the entire message, including the prefix and the trailing newline, into the buffer we already have (and which is still fixed size) and then write it out via `write_in_full()`.s/write_in_full/xwrite/ perhaps? Both the cover letter and the patch below use xwrite().Excellent eyes! I had originally used `write_in_full()` before realizing that `xwrite()` would be more appropriate.What's your reasoning there? We wouldn't expect xwrite() to ever return with a partial write. But if it did for whatever reason, surely we'd prefer to keep trying to print the rest of the error rather than leave it truncated? We might see an error on the subsequent write(), but it's worth calling it to find out, I'd think.
Oh, `xwrite()` does not write in full, eh? But at least it continues on `EINTR`... Will fix. Dscho