[openssl] master update

dev at ddvo.net dev at ddvo.net
Wed Apr 14 14:51:24 UTC 2021


The branch master has been updated
       via  f56c9c7c942cd82595bb47808c732048141dc72d (commit)
      from  3ad6030948ac999de165f6185116459d74644e8d (commit)


- Log -----------------------------------------------------------------
commit f56c9c7c942cd82595bb47808c732048141dc72d
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Sat Apr 3 14:05:09 2021 +0200

    APPS and TEST: Make sure prog name is set for usage output
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/14841)

-----------------------------------------------------------------------

Summary of changes:
 apps/cmp.c                 | 2 +-
 apps/lib/opt.c             | 3 +++
 test/evp_fetch_prov_test.c | 3 +--
 test/evp_test.c            | 3 +--
 test/testutil.h            | 8 ++++----
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/apps/cmp.c b/apps/cmp.c
index 135c509831..53996a7cc8 100644
--- a/apps/cmp.c
+++ b/apps/cmp.c
@@ -2536,8 +2536,8 @@ int cmp_main(int argc, char **argv)
     char mock_server[] = "mock server:1";
     int ret = 0; /* default: failure */
 
+    prog = opt_appname(argv[0]);
     if (argc <= 1) {
-        prog = opt_appname(argv[0]);
         opt_help(cmp_options);
         goto err;
     }
diff --git a/apps/lib/opt.c b/apps/lib/opt.c
index 8cc520daec..4077cf2936 100644
--- a/apps/lib/opt.c
+++ b/apps/lib/opt.c
@@ -162,6 +162,9 @@ char *opt_init(int ac, char **av, const OPTIONS *o)
     opts = o;
     unknown = NULL;
 
+    /* Make sure prog name is set for usage output */
+    (void)opt_progname(argv[0]);
+
     /* Check all options up until the PARAM marker (if present) */
     for (; o->name != NULL && o->name != OPT_PARAM_STR; ++o) {
 #ifndef NDEBUG
diff --git a/test/evp_fetch_prov_test.c b/test/evp_fetch_prov_test.c
index 18e57c76c6..ec339ebbc3 100644
--- a/test/evp_fetch_prov_test.c
+++ b/test/evp_fetch_prov_test.c
@@ -47,8 +47,7 @@ const OPTIONS *test_get_options(void)
         { "fetchfail", OPT_FETCH_FAILURE, '-', "fetch is expected to fail" },
         { "defaultctx", OPT_USE_DEFAULTCTX, '-',
           "Use the default context if this is set" },
-        { OPT_HELP_STR, 1, '-',
-          "file\tProvider names to explicitly load\n" },
+        { OPT_HELP_STR, 1, '-', "file\tProvider names to explicitly load\n" },
         { NULL }
     };
     return test_options;
diff --git a/test/evp_test.c b/test/evp_test.c
index a7a3cc4bb3..503aaa0e8e 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -3570,8 +3570,7 @@ const OPTIONS *test_get_options(void)
         OPT_TEST_OPTIONS_WITH_EXTRA_USAGE("[file...]\n"),
         { "config", OPT_CONFIG_FILE, '<',
           "The configuration file to use for the libctx" },
-        { OPT_HELP_STR, 1, '-',
-          "file\tFile to run tests on.\n" },
+        { OPT_HELP_STR, 1, '-', "file\tFile to run tests on.\n" },
         { NULL }
     };
     return test_options;
diff --git a/test/testutil.h b/test/testutil.h
index 8457a2a384..9311e2ce58 100644
--- a/test/testutil.h
+++ b/test/testutil.h
@@ -174,9 +174,9 @@
  * the test system.
  *
  * Tests that need to use opt_next() need to specify
- *  (1) test_get_options() containing an options[] (Which should include either
- *    OPT_TEST_OPTIONS_DEFAULT_USAGE OR
- *    OPT_TEST_OPTIONS_WITH_EXTRA_USAGE).
+ *  (1) test_get_options() containing an options[] which should include either
+ *    OPT_TEST_OPTIONS_DEFAULT_USAGE or
+ *    OPT_TEST_OPTIONS_WITH_EXTRA_USAGE(...).
  *  (2) An enum outside the test_get_options() which contains OPT_TEST_ENUM, as
  *      well as the additional options that need to be handled.
  *  (3) case OPT_TEST_CASES: break; inside the opt_next() handling code.
@@ -232,7 +232,7 @@ void cleanup_tests(void);
  * Used to supply test specific command line options,
  * If non optional parameters are used, then the first entry in the OPTIONS[]
  * should contain:
- * { OPT_HELP_STR, 1, '-', "list of non optional commandline params\n"},
+ * { OPT_HELP_STR, 1, '-', "<list of non-optional commandline params>\n"},
  * The last entry should always be { NULL }.
  *
  * Run the test locally using './test/test_name -help' to check the usage.


More information about the openssl-commits mailing list