]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal-file: cast file size to to fixed size type 26197/head
authorLennart Poettering <lennart@poettering.net>
Wed, 25 Jan 2023 13:09:19 +0000 (14:09 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 25 Jan 2023 13:17:20 +0000 (14:17 +0100)
(We generally avoid using off_t for file sizes/offsets, and instead use
uint64_t to get the same behaviour everywhere. Do so here too.)

src/libsystemd/sd-journal/journal-file.c
src/libsystemd/sd-journal/journal-verify.c

index 9db87481f18e13c96a235a91303f24c6942975c3..79fd9964fecbef5510e6d815afb2e72d9bb02aba 100644 (file)
@@ -4226,12 +4226,12 @@ bool journal_file_rotate_suggested(JournalFile *f, usec_t max_file_usec, int log
                 if (le64toh(f->header->n_data) * 4ULL > (le64toh(f->header->data_hash_table_size) / sizeof(HashItem)) * 3ULL) {
                         log_ratelimit_full(
                                 log_level, JOURNAL_LOG_RATELIMIT,
-                                "Data hash table of %s has a fill level at %.1f (%"PRIu64" of %"PRIu64" items, %llu file size, %"PRIu64" bytes per hash table item), suggesting rotation.",
+                                "Data hash table of %s has a fill level at %.1f (%"PRIu64" of %"PRIu64" items, %"PRIu64" file size, %"PRIu64" bytes per hash table item), suggesting rotation.",
                                 f->path,
                                 100.0 * (double) le64toh(f->header->n_data) / ((double) (le64toh(f->header->data_hash_table_size) / sizeof(HashItem))),
                                 le64toh(f->header->n_data),
                                 le64toh(f->header->data_hash_table_size) / sizeof(HashItem),
-                                (unsigned long long) f->last_stat.st_size,
+                                (uint64_t) f->last_stat.st_size,
                                 f->last_stat.st_size / le64toh(f->header->n_data));
                         return true;
                 }
index 1eca48536cf9023ee2282d2c1d7a96be88cdf858..b4ce3881a44a35c94585a511856d22565e613f98 100644 (file)
@@ -1377,11 +1377,11 @@ fail:
         if (show_progress)
                 flush_progress();
 
-        log_error("File corruption detected at %s:"OFSfmt" (of %llu bytes, %"PRIu64"%%).",
+        log_error("File corruption detected at %s:%"PRIu64" (of %"PRIu64" bytes, %"PRIu64"%%).",
                   f->path,
                   p,
-                  (unsigned long long) f->last_stat.st_size,
-                  100 * p / f->last_stat.st_size);
+                  (uint64_t) f->last_stat.st_size,
+                  100U * p / (uint64_t) f->last_stat.st_size);
 
         if (cache_data_fd)
                 mmap_cache_fd_free(cache_data_fd);