summaryrefslogtreecommitdiff
path: root/src/basic/fileio.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-02-19 18:24:36 +0100
committerLennart Poettering <lennart@poettering.net>2018-02-20 15:39:31 +0100
commit8ac2f74fb6bb798db1fb3f7a7bf97f2579e963c2 (patch)
tree8f8a5c71c02e842055c90db92fc9ee9271bce9f9 /src/basic/fileio.c
parent11b29a96e98054ed69a2314ed71a286e852fa24e (diff)
downloadsystemd-8ac2f74fb6bb798db1fb3f7a7bf97f2579e963c2.tar.gz
systemd-8ac2f74fb6bb798db1fb3f7a7bf97f2579e963c2.tar.bz2
systemd-8ac2f74fb6bb798db1fb3f7a7bf97f2579e963c2.zip
tree-wide: make use of fsync_directory_of_file() all over the place
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.
Diffstat (limited to 'src/basic/fileio.c')
-rw-r--r--src/basic/fileio.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index 26d6174664..29b941348a 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -1187,6 +1187,10 @@ int fflush_sync_and_check(FILE *f) {
if (fsync(fileno(f)) < 0)
return -errno;
+ r = fsync_directory_of_file(fileno(f));
+ if (r < 0)
+ return r;
+
return 0;
}