]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
ar: Don't crash when given files but no command.
authorRoland McGrath <roland@hack.frob.com>
Fri, 20 Jan 2012 20:04:19 +0000 (12:04 -0800)
committerRoland McGrath <roland@hack.frob.com>
Fri, 20 Jan 2012 20:04:19 +0000 (12:04 -0800)
src/ChangeLog
src/ar.c

index 46c277ce50d70fa71092b5a4d0c05e068c4c93c9..98c324216eb5993203b530fc0ad18769ba96202c 100644 (file)
@@ -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.
index 72b0237f502630e1660285a885ba2267eb60263a..147d9f2b103599a7b2504aa644aead5d0aedf472 100644 (file)
--- 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);