diff options
author | Roland McGrath <roland@hack.frob.com> | 2012-01-20 12:04:19 -0800 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2012-01-20 12:04:19 -0800 |
commit | 9bffd3604c25bb688fe3a1c19654891d4df47272 (patch) | |
tree | 4014981429494baecc4bc0f9ce1cdaeb13c0dea1 | |
parent | 6e063d99a12beedde3ce1d4dc75c428d0ee7600e (diff) |
ar: Don't crash when given files but no command.
-rw-r--r-- | src/ChangeLog | 2 | ||||
-rw-r--r-- | src/ar.c | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 46c277ce..98c32421 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2012-01-20 Roland McGrath <roland@hack.frob.com> + * 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. @@ -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); |