]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: stat journal file after truncating
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 25 Jan 2022 23:53:58 +0000 (23:53 +0000)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 27 Jan 2022 14:46:59 +0000 (14:46 +0000)
Let's make sure the data stored in last_stat is up-to-date after
truncating the journal file.

src/journal/journald-file.c

index 0e698e329b05db24065a44a5861ac6295722bde1..9337925ffdeba3c58d716c3fa25506b14302a22d 100644 (file)
@@ -31,9 +31,9 @@ static int journald_file_truncate(JournalFile *f) {
         f->header->arena_size = htole64(p - le64toh(f->header->header_size));
 
         if (ftruncate(f->fd, p) < 0)
-                log_debug_errno(errno, "Failed to truncate %s: %m", f->path);
+                return log_debug_errno(errno, "Failed to truncate %s: %m", f->path);
 
-        return 0;
+        return journal_file_fstat(f);
 }
 
 static int journald_file_entry_array_punch_hole(JournalFile *f, uint64_t p, uint64_t n_entries) {