X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournalctl.c;h=0afeef932e54b89f615cf91570b0d0c239240894;hb=641906e9366891e0ad3e6e38b7396a427678c4cf;hp=0ec2f331db271b85e92079e9d0629456f666c23b;hpb=67e04a486b92fcb656049cb4d6b66148c7d2e61b;p=elogind.git diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 0ec2f331d..0afeef932 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -244,8 +244,25 @@ static int parse_argv(int argc, char *argv[]) { log_error("Failed to parse lines '%s'", optarg); return -EINVAL; } - } else - arg_lines = 10; + } else { + int n; + + /* Hmm, no argument? Maybe the next + * word on the command line is + * supposed to be the argument? Let's + * see if there is one, and is + * parsable as a positive + * integer... */ + + if (optind < argc && + safe_atoi(argv[optind], &n) >= 0 && + n >= 0) { + + arg_lines = n; + optind++; + } else + arg_lines = 10; + } break;