We've been using open;write;close;rename for udpating mnemon files,
but with recent discussion of ext4 failure modes, Ted has taught
that the only reliable way of getting the desired results is to
fsync before the close. That fsync does more than we really want
here, but there's no way to ask for a less heavy version of what
we want.
#include <sys/types.h>
#include <sys/time.h>
+#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
category_print (category, file);
+ fsync (fileno (file));
fclose (file);
err = rename (lock_filename, filename);