Revert "Check directory is able to create files for various -out option"
[openssl.git] / apps / prime.c
index 3c72330c0a62ac9e6973885c02e88663546a97df..6944797646962c369f3f7bed27c7f4086282c270 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -10,6 +10,7 @@
 #include <string.h>
 
 #include "apps.h"
 #include <string.h>
 
 #include "apps.h"
+#include "progs.h"
 #include <openssl/bn.h>
 
 typedef enum OPTION_choice {
 #include <openssl/bn.h>
 
 typedef enum OPTION_choice {
@@ -43,6 +44,7 @@ int prime_main(int argc, char **argv)
         switch (o) {
         case OPT_EOF:
         case OPT_ERR:
         switch (o) {
         case OPT_EOF:
         case OPT_ERR:
+opthelp:
             BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
             goto end;
         case OPT_HELP:
             BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
             goto end;
         case OPT_HELP:
@@ -69,9 +71,14 @@ int prime_main(int argc, char **argv)
     argc = opt_num_rest();
     argv = opt_rest();
 
     argc = opt_num_rest();
     argv = opt_rest();
 
-    if (argc == 0 && !generate) {
+    if (generate) {
+        if (argc != 0) {
+            BIO_printf(bio_err, "Extra arguments given.\n");
+            goto opthelp;
+        }
+    } else if (argc == 0) {
         BIO_printf(bio_err, "%s: No prime specified\n", prog);
         BIO_printf(bio_err, "%s: No prime specified\n", prog);
-        goto end;
+        goto opthelp;
     }
 
     if (generate) {
     }
 
     if (generate) {