]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: start properly syncing at various places we so far didn't 28017/head
authorLennart Poettering <lennart@poettering.net>
Tue, 13 Jun 2023 07:49:50 +0000 (09:49 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 13 Jun 2023 07:50:10 +0000 (09:50 +0200)
Let's better be safe than sorry, and install files fully safely now that
is is easy.

src/boot/bootctl-install.c
src/portable/portable.c
src/shared/hwdb-util.c

index 26e18e3707ac28fa9da0082b72732208d6af32df..397db7d3a2eeccbffb773bf39fea44f06c0b3de4 100644 (file)
@@ -454,7 +454,7 @@ static int install_loader_config(const char *esp_path) {
                 fprintf(f, "default %s-*\n", arg_entry_token);
         }
 
-        r = flink_tmpfile(f, t, p, /* flags= */ 0);
+        r = flink_tmpfile(f, t, p, LINK_TMPFILE_SYNC);
         if (r == -EEXIST)
                 return 0; /* Silently skip creation if the file exists now (recheck) */
         if (r < 0)
@@ -483,7 +483,7 @@ static int install_loader_specification(const char *root) {
 
         fprintf(f, "type1\n");
 
-        r = flink_tmpfile(f, t, p, /* flags= */ 0);
+        r = flink_tmpfile(f, t, p, LINK_TMPFILE_SYNC);
         if (r == -EEXIST)
                 return 0; /* Silently skip creation if the file exists now (recheck) */
         if (r < 0)
index 44c69c0bebbc431e857372e5744a0398b94472f5..7d1fc87a912333018723fdeb8d5c3c9b44c153bd 100644 (file)
@@ -1295,7 +1295,7 @@ static int attach_unit_file(
                 if (fchmod(fd, 0644) < 0)
                         return log_debug_errno(errno, "Failed to change unit file access mode for '%s': %m", path);
 
-                r = link_tmpfile(fd, tmp, path, /* flags= */ 0);
+                r = link_tmpfile(fd, tmp, path, LINK_TMPFILE_SYNC);
                 if (r < 0)
                         return log_debug_errno(r, "Failed to install unit file '%s': %m", path);
 
index cf41d6a474aac47a8388aa08e3703dead9c25f19..59b678c424d8548db724d2e3b60b588fe8a41c4a 100644 (file)
@@ -408,7 +408,7 @@ static int trie_store(struct trie *trie, const char *filename, bool compat) {
                 return -errno;
         fwrite(&h, sizeof(struct trie_header_f), 1, f);
 
-        r = flink_tmpfile(f, filename_tmp, filename, LINK_TMPFILE_REPLACE);
+        r = flink_tmpfile(f, filename_tmp, filename, LINK_TMPFILE_REPLACE|LINK_TMPFILE_SYNC);
         if (r < 0)
                 return r;