}
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;
}
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) {
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)