From: Mike Yuan Date: Thu, 3 Jul 2025 20:30:12 +0000 (+0200) Subject: journal-file: const and _pure_'ify journal_file_writable() X-Git-Tag: v258-rc1~152^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d75219711f9470fa04d36f224b4f36f1622eb842;p=thirdparty%2Fsystemd.git journal-file: const and _pure_'ify journal_file_writable() Follow-up for 1543c2385c0a1afbdc59b50c8ecd132a0d60bbef --- diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index baabb92fd70..11e251748a2 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -4694,8 +4694,9 @@ bool journal_file_rotate_suggested(JournalFile *f, usec_t max_file_usec, int log return false; } -bool journal_file_writable(JournalFile *f) { +bool journal_file_writable(const JournalFile *f) { assert(f); + return (f->open_flags & O_ACCMODE_STRICT) != O_RDONLY; } diff --git a/src/libsystemd/sd-journal/journal-file.h b/src/libsystemd/sd-journal/journal-file.h index 4a5e0d81e2f..68317f13086 100644 --- a/src/libsystemd/sd-journal/journal-file.h +++ b/src/libsystemd/sd-journal/journal-file.h @@ -378,4 +378,4 @@ static inline uint32_t COMPRESSION_TO_HEADER_INCOMPATIBLE_FLAG(Compression c) { } } -bool journal_file_writable(JournalFile *f); +bool journal_file_writable(const JournalFile *f) _pure_;