summaryrefslogtreecommitdiffstats
path: root/src/coredump
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/coredump
parentfs-util: move fsync_directory_of_file() into generic code (diff)
downloadsystemd-8ac2f74fb6bb798db1fb3f7a7bf97f2579e963c2.tar.xz
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/coredump')
-rw-r--r--src/coredump/coredump.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index 6900af9fb5..e924750d1b 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -260,6 +260,8 @@ static int fix_permissions(
if (fsync(fd) < 0)
return log_error_errno(errno, "Failed to sync coredump %s: %m", coredump_tmpfile_name(filename));
+ (void) fsync_directory_of_file(fd);
+
r = link_tmpfile(fd, filename, target);
if (r < 0)
return log_error_errno(r, "Failed to move coredump %s into place: %m", target);