From: Roland McGrath Date: Fri, 20 Jan 2012 20:04:19 +0000 (-0800) Subject: ar: Don't crash when given files but no command. X-Git-Tag: elfutils-0.153~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9bffd3604c25bb688fe3a1c19654891d4df47272;p=thirdparty%2Felfutils.git ar: Don't crash when given files but no command. --- diff --git a/src/ChangeLog b/src/ChangeLog index 46c277ce5..98c324216 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2012-01-20 Roland McGrath + * ar.c (main): Handle oper_none as usage error. + * arlib-argp.c (options, parse_opt): Grok -U as inverse of -D. * ranlib.c (argp): Use arlib_argp_children. diff --git a/src/ar.c b/src/ar.c index 72b0237f5..147d9f2b1 100644 --- a/src/ar.c +++ b/src/ar.c @@ -252,6 +252,13 @@ MEMBER parameter required for 'a', 'b', and 'i' modifiers")); int status; switch (operation) { + case oper_none: + error (0, 0, gettext ("command option required")); + argp_help (&argp, stderr, ARGP_HELP_STD_ERR, + program_invocation_short_name); + status = 1; + break; + case oper_list: case oper_print: status = do_oper_extract (operation, arfname, argv, argc, -1);