diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-03-21 21:26:02 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-03-25 13:39:37 +0100 |
commit | f936ae212086217db0cf0c069d244b928c729126 (patch) | |
tree | c4285998a46f283208ee193253c8c372edf85baa /src/journal-remote | |
parent | coredumpctl: use strv_skip() (diff) | |
download | systemd-f936ae212086217db0cf0c069d244b928c729126.tar.xz systemd-f936ae212086217db0cf0c069d244b928c729126.zip |
journal-gateway: use journal_add_match_pair() and add_match_boot_id()
Diffstat (limited to 'src/journal-remote')
-rw-r--r-- | src/journal-remote/journal-gatewayd.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index d88436018c..c747253858 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -22,6 +22,7 @@ #include "fileio.h" #include "glob-util.h" #include "hostname-util.h" +#include "journal-internal.h" #include "journal-remote.h" #include "log.h" #include "logs-show.h" @@ -460,7 +461,6 @@ static mhd_result request_parse_arguments_iterator( const char *value) { RequestMeta *m = ASSERT_PTR(cls); - _cleanup_free_ char *p = NULL; int r; if (isempty(key)) { @@ -512,7 +512,6 @@ static mhd_result request_parse_arguments_iterator( } if (r) { - char match[9 + 32 + 1] = "_BOOT_ID="; sd_id128_t bid; r = sd_id128_get_boot(&bid); @@ -521,8 +520,7 @@ static mhd_result request_parse_arguments_iterator( return MHD_NO; } - sd_id128_to_string(bid, match + 9); - r = sd_journal_add_match(m->journal, match, sizeof(match)-1); + r = add_match_boot_id(m->journal, bid); if (r < 0) { m->argument_parse_error = r; return MHD_NO; @@ -532,13 +530,7 @@ static mhd_result request_parse_arguments_iterator( return MHD_YES; } - p = strjoin(key, "=", strempty(value)); - if (!p) { - m->argument_parse_error = log_oom(); - return MHD_NO; - } - - r = sd_journal_add_match(m->journal, p, 0); + r = journal_add_match_pair(m->journal, key, strempty(value)); if (r < 0) { m->argument_parse_error = r; return MHD_NO; |