From: Luca Boccassi Date: Mon, 12 Jun 2023 22:51:51 +0000 (+0100) Subject: portable: make sure to fsync after extracting/copying X-Git-Tag: v254-rc1~226^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F28014%2Fhead;p=thirdparty%2Fsystemd.git portable: make sure to fsync after extracting/copying Just in case we are on a flimsy filesystem/disk --- 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);