manu@... writes:
motivate figuring out how to not do it sometimes.
> Greg Troxel <gdt@...> wrote:Yes, looks good. This isn't frequent, so it shouldn't hurt enough to
>
>> fflush()
>> fsync()
>> fclose()
>
> So we would do that?
>
> Index: dump.c
> ===================================================================
> RCS file: /milter-greylist/milter-greylist/dump.c,v
> retrieving revision 1.35
> diff -U2 -r1.35 dump.c
> --- dump.c 29 Dec 2007 19:06:49 -0000 1.35
> +++ dump.c 20 Mar 2009 20:30:02 -0000
> @@ -288,5 +288,13 @@
> "whitelisted\n#\n", done, greylisted_count,
> whitelisted_count);
>
> - Fclose(dump);
> + /*
> + * Ensure that the data is really flushed to disk.
> + * Some systems might delay the data write from kernel buffer
> + * to disk even after the file is closed
> + */
> + (void)fflush(dump);
> + (void)fsync(fileno(dump));
> + (void)Fclose(dump);
> +
> if (s_buffer)
> free(s_buffer);
motivate figuring out how to not do it sometimes.