summaryrefslogtreecommitdiffstats
path: root/sys-utils/setarch.c
diff options
context:
space:
mode:
authorSami Kerola2012-06-16 22:59:47 +0200
committerSami Kerola2012-06-17 17:59:59 +0200
commitedf1cf0af541cd4ffe5d91d776627e0d70ded184 (patch)
tree2bb83f7b4ee7b0ca6044dcba5b2d65b5c34658b5 /sys-utils/setarch.c
parenthexdump: print sensible message when all input file arguments fail (diff)
downloadkernel-qcow2-util-linux-edf1cf0af541cd4ffe5d91d776627e0d70ded184.tar.gz
kernel-qcow2-util-linux-edf1cf0af541cd4ffe5d91d776627e0d70ded184.tar.xz
kernel-qcow2-util-linux-edf1cf0af541cd4ffe5d91d776627e0d70ded184.zip
setarch: disallow unknown command line options
Exit with instruction to run --help if unknown option is encountered. Before the following example printed error, but resulted to an attempt to run argument. $ x86_64 -x ls Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/setarch.c')
-rw-r--r--sys-utils/setarch.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index a0c6ea81f..f2315a660 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -122,7 +122,10 @@ show_help(void)
static void __attribute__((__noreturn__))
show_usage(const char *s)
{
- errx(EXIT_FAILURE, _("%s\nTry `%s --help' for more information."), s, program_invocation_short_name);
+ if (s)
+ errx(EXIT_FAILURE, _("%s\nTry `%s --help' for more information."), s, program_invocation_short_name);
+ else
+ errx(EXIT_FAILURE, _("Try `%s --help' for more information."), program_invocation_short_name);
}
static void __attribute__((__noreturn__))
@@ -325,6 +328,8 @@ int main(int argc, char *argv[])
case OPT_UNAME26:
turn_on(UNAME26, options);
break;
+ default:
+ show_usage(NULL);
}
}