Re: [PATCH v5] gc: ignore old gc.log files
From: Jeff King <hidden>
Date: 2017-02-10 21:32:33
On Fri, Feb 10, 2017 at 09:23:15PM +0000, David Turner wrote:
quoted
Speaking of stderr, I wonder if this function should be calling fflush(stderr) before looking at the fstat result. There could be contents buffered there that haven't been written out yet (not from child processes, but perhaps ones written in this process itself). Probably unlikely in practice, since stderr is typically unbuffered by default.Process_log_file_at_exit calls fflush. Will fix the other.
Ah, good. That makes sense, since we might deadlock if we do it in a signal handler. Perhaps that is a reason not to use stderr here again (though if we want to be that careful, a new fdopen() call is also a bad idea, as we can deadlock over the malloc() lock; you'd have to snprintf to a small buffer and dump it with write()). -Peff