diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index a5ed41d..f5165e9 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -88,6 +88,7 @@ static bool arg_dmesg = false; static const char *arg_cursor = NULL; static const char *arg_after_cursor = NULL; static bool arg_show_cursor = false; +static bool arg_skip_entries = false; static const char *arg_directory = NULL; static char **arg_file = NULL; static int arg_priorities = 0xFF; @@ -197,6 +198,7 @@ static void help(void) { " -c --cursor=CURSOR Show entries starting at the specified cursor\n" " --after-cursor=CURSOR Show entries after the specified cursor\n" " --show-cursor Print the cursor after all the entries\n" + " --skip-entries Skip corrupted entries in the journal\n" " -b --boot[=ID] Show current boot or the specified boot\n" " --list-boots Show terse information about recorded boots\n" " -k --dmesg Show kernel message log from the current boot\n" @@ -270,6 +272,7 @@ static int parse_argv(int argc, char *argv[]) { ARG_UNTIL, ARG_AFTER_CURSOR, ARG_SHOW_CURSOR, + ARG_SKIP_ENTRIES, ARG_USER_UNIT, ARG_LIST_CATALOG, ARG_DUMP_CATALOG, @@ -317,6 +320,7 @@ static int parse_argv(int argc, char *argv[]) { { "cursor", required_argument, NULL, 'c' }, { "after-cursor", required_argument, NULL, ARG_AFTER_CURSOR }, { "show-cursor", no_argument, NULL, ARG_SHOW_CURSOR }, + { "skip-entries", no_argument, NULL, ARG_SKIP_ENTRIES }, { "since", required_argument, NULL, ARG_SINCE }, { "until", required_argument, NULL, ARG_UNTIL }, { "unit", required_argument, NULL, 'u' }, @@ -516,6 +520,10 @@ static int parse_argv(int argc, char *argv[]) { arg_show_cursor = true; break; + case ARG_SKIP_ENTRIES: + arg_skip_entries = true; + break; + case ARG_HEADER: arg_action = ACTION_PRINT_HEADER; break; @@ -2069,6 +2077,8 @@ int main(int argc, char *argv[]) { need_seek = true; if (r == -EADDRNOTAVAIL) break; + else if (r < 0 && arg_skip_entries) + continue; else if (r < 0 || ferror(stdout)) goto finish;