From 7d812d7ca1c8b377d8da0f10549e91e9887619c3 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 12 Jun 2023 23:51:51 +0100 Subject: [PATCH] portable: make sure to fsync after extracting/copying Just in case we are on a flimsy filesystem/disk --- src/portable/portable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/portable/portable.c b/src/portable/portable.c index 6b3fd004407..7cf1eddd4d2 100644 --- a/src/portable/portable.c +++ b/src/portable/portable.c @@ -1142,7 +1142,7 @@ static int install_chroot_dropin( } } - r = write_string_file(dropin, text, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC); + r = write_string_file(dropin, text, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC|WRITE_STRING_FILE_SYNC); if (r < 0) return log_debug_errno(r, "Failed to write '%s': %m", dropin); @@ -1189,7 +1189,7 @@ static int install_profile_dropin( if (flags & PORTABLE_PREFER_COPY) { - r = copy_file_atomic(from, dropin, 0644, COPY_REFLINK); + r = copy_file_atomic(from, dropin, 0644, COPY_REFLINK|COPY_FSYNC); if (r < 0) return log_debug_errno(r, "Failed to copy %s %s %s: %m", from, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), dropin); -- 2.47.3