diff options
-rw-r--r-- | src/journal-remote/journal-gatewayd.c | 10 | ||||
-rw-r--r-- | src/shared/logs-show.c | 17 |
2 files changed, 15 insertions, 12 deletions
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index c747253858..17565f260a 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -512,15 +512,7 @@ static mhd_result request_parse_arguments_iterator( } if (r) { - sd_id128_t bid; - - r = sd_id128_get_boot(&bid); - if (r < 0) { - log_error_errno(r, "Failed to get boot ID: %m"); - return MHD_NO; - } - - r = add_match_boot_id(m->journal, bid); + r = add_match_boot_id(m->journal, SD_ID128_NULL); if (r < 0) { m->argument_parse_error = r; return MHD_NO; diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 8633e48647..bbcaf6825e 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -1636,10 +1636,21 @@ int add_matches_for_user_unit(sd_journal *j, const char *unit, uid_t uid) { } int add_match_boot_id(sd_journal *j, sd_id128_t id) { + int r; + assert(j); - assert(!sd_id128_is_null(id)); - return journal_add_match_pair(j, "_BOOT_ID", SD_ID128_TO_STRING(id)); + if (sd_id128_is_null(id)) { + r = sd_id128_get_boot(&id); + if (r < 0) + return log_error_errno(r, "Failed to get boot ID: %m"); + } + + r = journal_add_match_pair(j, "_BOOT_ID", SD_ID128_TO_STRING(id)); + if (r < 0) + return log_error_errno(r, "Failed to add match: %m"); + + return 0; } int add_match_this_boot(sd_journal *j, const char *machine) { @@ -1655,7 +1666,7 @@ int add_match_this_boot(sd_journal *j, const char *machine) { r = add_match_boot_id(j, boot_id); if (r < 0) - return log_error_errno(r, "Failed to add match: %m"); + return r; r = sd_journal_add_conjunction(j); if (r < 0) |