Let's make use this at various places we call fsync(), to make things
fully reliable, as the kernel devs suggest to first fsync() files and
then fsync() the directories they are located in.
if (fsync(fileno(f)) < 0)
return -errno;
+ r = fsync_directory_of_file(fileno(f));
+ if (r < 0)
+ return r;
+
return 0;
}
#include <unistd.h>
#include "fd-util.h"
+//#include "fs-util.h"
#include "hexdecoct.h"
#include "id128-util.h"
#include "io-util.h"
if (do_sync) {
if (fsync(fd) < 0)
return -errno;
+
+ r = fsync_directory_of_file(fd);
+ if (r < 0)
+ return r;
}
- return r;
+ return 0;
}
#if 0 /// UNNEEDED by elogind