chiark / gitweb /
journalctl: refuse extra arguments with --verify and similar
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 27 Feb 2014 04:01:43 +0000 (23:01 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 27 Feb 2014 05:43:24 +0000 (00:43 -0500)
Positional arguments only make sense with the default action.
For other actions, complain instead of ignoring them silently.

src/journal/journalctl.c

index a328ba1..0619b25 100644 (file)
@@ -658,6 +658,11 @@ static int parse_argv(int argc, char *argv[]) {
                 return -EINVAL;
         }
 
+        if (arg_action != ACTION_SHOW && optind < argc) {
+                log_error("Extraneous arguments starting with '%s'", argv[optind]);
+                return -EINVAL;
+        }
+
         return 1;
 }