On Tue, Oct 2, 2018 at 6:34 PM Ben Peart <peartben@xxxxxxxxx> wrote: > >> + offset = lseek(newfd, 0, SEEK_CUR) + write_buffer_len; > > > > This only works correctly if the ce_write_entry() from the last > > iteration has flushed everything to out to newfd. Maybe it does, but > > it's error prone to rely on that in my opinion. Maybe we need an > > explicit ce_write_flush() here to make sure. > > > > This logic already takes any unflushed data into account - the offset is > what has been flushed to disk (lseek) plus the amount still in the > buffer (write_buffer_len) waiting to be flushed. I don't see any need > to force an additional flush and adding one could have a negative impact > on performance. Eck! How did I miss that write_buffer_len :P -- Duy