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