diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-06-22 17:11:00 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-06-23 09:45:50 +0200 |
commit | 4a78074fc14c684600f2bbdac7b5bb13325aba39 (patch) | |
tree | cc6e9b4a5d6de5f8e0228feb7ee306a430582084 /src/coredump | |
parent | coredump: use loop_read() for reading coredump into memory (diff) | |
download | systemd-4a78074fc14c684600f2bbdac7b5bb13325aba39.tar.xz systemd-4a78074fc14c684600f2bbdac7b5bb13325aba39.zip |
coredump: clamp JournalSizeMax= to maximum journald would accept
See: #26748
Diffstat (limited to 'src/coredump')
-rw-r--r-- | src/coredump/coredump.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index 940c0def61..39b777b535 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -172,9 +172,27 @@ static int parse_config(void) { {} }; - return config_parse_config_file("coredump.conf", "Coredump\0", - config_item_table_lookup, items, - CONFIG_PARSE_WARN, NULL); + int r; + + r = config_parse_config_file( + "coredump.conf", + "Coredump\0", + config_item_table_lookup, + items, + CONFIG_PARSE_WARN, + /* userdata= */ NULL); + if (r < 0) + return r; + + /* Let's make sure we fix up the maximum size we send to the journal here on the client side, for + * efficiency reasons. journald wouldn't accept anything larger anyway. */ + if (arg_journal_size_max > JOURNAL_SIZE_MAX) { + log_warning("JournalSizeMax= set to larger value (%s) than journald would accept (%s), lowering automatically.", + FORMAT_BYTES(arg_journal_size_max), FORMAT_BYTES(JOURNAL_SIZE_MAX)); + arg_journal_size_max = JOURNAL_SIZE_MAX; + } + + return 0; } static uint64_t storage_size_max(void) { |