From 60b10a1f9889fc622f8e304a2f752020f604ed46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Sat, 20 Apr 2013 01:21:11 +0200 Subject: [PATCH 5/6] Refuse unrecognized command-line operands (Inconsistent options are still accepted.) https://bugs.freedesktop.org/show_bug.cgi?id=29936 --- src/programs/pkaction.c | 6 ++++++ src/programs/pkcheck.c | 6 ++++++ src/programs/pkttyagent.c | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/src/programs/pkaction.c b/src/programs/pkaction.c index b8b60b3..461aba7 100644 --- a/src/programs/pkaction.c +++ b/src/programs/pkaction.c @@ -146,6 +146,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); diff --git a/src/programs/pkcheck.c b/src/programs/pkcheck.c index 51e1de1..687ca39 100644 --- a/src/programs/pkcheck.c +++ b/src/programs/pkcheck.c @@ -481,6 +481,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) { diff --git a/src/programs/pkttyagent.c b/src/programs/pkttyagent.c index 83b9bd9..f95442e 100644 --- a/src/programs/pkttyagent.c +++ b/src/programs/pkttyagent.c @@ -94,6 +94,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) { -- 1.8.1.4