84b277
From f951a4b2dbbfdb8c387a802d0ae56ce47470f679 Mon Sep 17 00:00:00 2001
84b277
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
84b277
Date: Wed, 26 Feb 2014 23:01:43 -0500
84b277
Subject: [PATCH] journalctl: refuse extra arguments with --verify and similar
84b277
84b277
Positional arguments only make sense with the default action.
84b277
For other actions, complain instead of ignoring them silently.
84b277
84b277
(cherry-picked from 0b6b7c2004317da48e5bbd3078c5662d8f0061b6)
84b277
84b277
Resolves: #1147524
84b277
---
84b277
 src/journal/journalctl.c | 5 +++++
84b277
 1 file changed, 5 insertions(+)
84b277
84b277
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
84b277
index 54e3ddd..3113e65 100644
84b277
--- a/src/journal/journalctl.c
84b277
+++ b/src/journal/journalctl.c
84b277
@@ -584,6 +584,11 @@ static int parse_argv(int argc, char *argv[]) {
84b277
                 return -EINVAL;
84b277
         }
84b277
 
84b277
+        if (arg_action != ACTION_SHOW && optind < argc) {
84b277
+                log_error("Extraneous arguments starting with '%s'", argv[optind]);
84b277
+                return -EINVAL;
84b277
+        }
84b277
+
84b277
         return 1;
84b277
 }
84b277