X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjournal%2Fjournalctl.c;h=de972a17dbe0b385f44bee421f44d86a5623bbc2;hp=2e672fa09655fb93dd26774c5acb6b73ebfc5e49;hb=a72b63536f1da3a97677bf38590f22a962e5fe98;hpb=99271804172f6ac51be9556b2bdf37d6a7e952bc diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 2e672fa09..de972a17d 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -591,33 +591,10 @@ static int add_matches(sd_journal *j, char **args) { } static int add_this_boot(sd_journal *j) { - char match[9+32+1] = "_BOOT_ID="; - sd_id128_t boot_id; - int r; - - assert(j); - if (!arg_this_boot) return 0; - r = sd_id128_get_boot(&boot_id); - if (r < 0) { - log_error("Failed to get boot id: %s", strerror(-r)); - return r; - } - - sd_id128_to_string(boot_id, match + 9); - r = sd_journal_add_match(j, match, strlen(match)); - if (r < 0) { - log_error("Failed to add match: %s", strerror(-r)); - return r; - } - - r = sd_journal_add_conjunction(j); - if (r < 0) - return r; - - return 0; + return add_match_this_boot(j); } static int add_dmesg(sd_journal *j) { @@ -1311,11 +1288,10 @@ int main(int argc, char *argv[]) { log_error("Failed to iterate through journal: %s", strerror(-r)); goto finish; } + if (r == 0) + break; } - if (r == 0) - break; - if (arg_until_set && !arg_reverse) { usec_t usec; @@ -1361,10 +1337,12 @@ int main(int argc, char *argv[]) { arg_catalog * OUTPUT_CATALOG; r = output_journal(stdout, j, arg_output, 0, flags); - if (r < 0 || ferror(stdout)) + need_seek = true; + if (r == -EADDRNOTAVAIL) + break; + else if (r < 0 || ferror(stdout)) goto finish; - need_seek = true; n_shown++; }