From: Jeff King Date: Fri, 10 Feb 2017 21:32:27 GMT Subject: Re: [PATCH v5] gc: ignore old gc.log files Message-ID: <20170210213227.wviuppcqb42kk3ww@sigill.intra.peff.net> In-Reply-To: <069b229470204235b7155b33da52421c@exmbdft7.ad.twosigma.com> On Fri, Feb 10, 2017 at 09:23:15PM +0000, David Turner wrote: > > 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