]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal-file-util: use the file descriptor of journal file on copy 31331/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 14 Feb 2024 00:36:45 +0000 (09:36 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 15 Feb 2024 15:25:37 +0000 (00:25 +0900)
No effective functionality changed, just refactoring.

src/shared/journal-file-util.c

index 944c317c9a71cbfc4a27bea16813add626a34723..b9c44442c314f4d75df26fd852adea530502396e 100644 (file)
@@ -210,11 +210,12 @@ static void journal_file_set_offline_internal(JournalFile *f) {
 
                                 log_debug_errno(r, "Failed to re-enable copy-on-write for %s: %m, rewriting file", f->path);
 
-                                r = copy_file_atomic_full(FORMAT_PROC_FD_PATH(f->fd), f->path, f->mode,
-                                                          0,
-                                                          FS_NOCOW_FL,
-                                                          COPY_REPLACE | COPY_FSYNC | COPY_HOLES | COPY_ALL_XATTRS,
-                                                          NULL, NULL);
+                                r = copy_file_atomic_at_full(
+                                                f->fd, NULL, AT_FDCWD, f->path, f->mode,
+                                                0,
+                                                FS_NOCOW_FL,
+                                                COPY_REPLACE | COPY_FSYNC | COPY_HOLES | COPY_ALL_XATTRS,
+                                                NULL, NULL);
                                 if (r < 0) {
                                         log_debug_errno(r, "Failed to rewrite %s: %m", f->path);
                                         continue;