Refuse unrecognized command-line operands
authorMiloslav Trmač <mitr@redhat.com>
Fri, 19 Apr 2013 23:21:11 +0000 (01:21 +0200)
committerMiloslav Trmač <mitr@redhat.com>
Mon, 13 May 2013 15:41:37 +0000 (17:41 +0200)
(Inconsistent options are still accepted.)

https://bugs.freedesktop.org/show_bug.cgi?id=29936

src/programs/pkaction.c
src/programs/pkcheck.c
src/programs/pkttyagent.c

index 3778b33055b7d58a8674426403055b182120d0ce..ad68659caae055e09fdf6aa99c09ed847830e03e 100644 (file)
@@ -140,6 +140,12 @@ main (int argc, char *argv[])
       g_error_free (error);
       goto out;
     }
+  if (argc > 1)
+    {
+      g_printerr (_("%s: Unexpected argument `%s'\n"), g_get_prgname (),
+                 argv[1]);
+      goto out;
+    }
   if (opt_show_version)
     {
       g_print ("pkaction version %s\n", PACKAGE_VERSION);
index ebb375ecd1c25c2460c546ffb51ccc808d7600b0..9076693fd4d3b9141c89509fc284108fbd251686 100644 (file)
@@ -477,6 +477,12 @@ main (int argc, char *argv[])
           break;
         }
     }
+  if (argv[n] != NULL)
+    {
+      g_printerr (_("%s: Unexpected argument `%s'\n"), g_get_prgname (),
+                 argv[n]);
+      goto out;
+    }
 
   if (opt_show_help)
     {
index ba09973374cc67d7568c13091b3473bab753876c..e5088bba2582eeeb829b4562354ed3cf97473f48 100644 (file)
@@ -90,6 +90,12 @@ main (int argc, char *argv[])
       g_error_free (error);
       goto out;
     }
+  if (argc > 1)
+    {
+      g_printerr (_("%s: Unexpected argument `%s'\n"), g_get_prgname (),
+                 argv[1]);
+      goto out;
+    }
 
   if (opt_show_version)
     {