Check # of arguments for remaining commands.
[openssl.git] / apps / openssl.c
index 2b43b1bd7be1b1ade3cd688b1e3d7561aefb0042..8a67328caceaf7405273bdb191b4a86e7179307d 100644 (file)
@@ -388,6 +388,7 @@ int list_main(int argc, char **argv)
         switch (o) {
         case OPT_EOF:  /* Never hit, but suppresses warning */
         case OPT_ERR:
+opthelp:
             BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
             return 1;
         case OPT_HELP:
@@ -429,12 +430,14 @@ int list_main(int argc, char **argv)
         }
         done = 1;
     }
-
-    if (!done) {
-        BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
-        return 1;
+    if (opt_num_rest() != 0) {
+        BIO_printf(bio_err, "Extra arguments given.\n");
+        goto opthelp;
     }
 
+    if (!done)
+        goto opthelp;
+
     return 0;
 }