diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-01-07 09:00:02 +0100 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-01-11 19:39:49 +0100 |
commit | 3372039252c4d9c67de784a0fbdad5589991a347 (patch) | |
tree | 687417a67e1027ce1d90cd448b0b03b05a8e90df /apps/openssl.c | |
parent | apps/pkey.c: Forther improve user guidance, also on non-sensical option combi... (diff) | |
download | openssl-3372039252c4d9c67de784a0fbdad5589991a347.tar.xz openssl-3372039252c4d9c67de784a0fbdad5589991a347.zip |
APPS: Fix confusion between program and app/command name used in diagnostic/help output
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13799)
Diffstat (limited to 'apps/openssl.c')
-rw-r--r-- | apps/openssl.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/apps/openssl.c b/apps/openssl.c index e6746087ad..0c95a7585e 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -235,6 +235,7 @@ int main(int argc, char *argv[]) FUNCTION f, *fp; LHASH_OF(FUNCTION) *prog = NULL; char *pname; + const char *fname; ARGS arg; int ret = 0; @@ -249,9 +250,7 @@ int main(int argc, char *argv[]) #if defined(OPENSSL_SYS_VMS) && defined(__DECC) argv = copy_argv(&argc, argv); #elif defined(_WIN32) - /* - * Replace argv[] with UTF-8 encoded strings. - */ + /* Replace argv[] with UTF-8 encoded strings. */ win32_utf8argv(&argc, &argv); #endif @@ -259,18 +258,11 @@ int main(int argc, char *argv[]) setup_trace(getenv("OPENSSL_TRACE")); #endif - if (!apps_startup()) { - BIO_printf(bio_err, - "FATAL: Startup failure (dev note: apps_startup() failed)\n"); - ERR_print_errors(bio_err); - ret = 1; - goto end; - } - - prog = prog_init(); - if (prog == NULL) { + if ((fname = "apps_startup", !apps_startup()) + || (fname = "prog_init", (prog = prog_init()) == NULL)) { BIO_printf(bio_err, - "FATAL: Startup failure (dev note: prog_init() failed)\n"); + "FATAL: Startup failure (dev note: %s()) for %s\n", + fname, argv[0]); ERR_print_errors(bio_err); ret = 1; goto end; @@ -288,6 +280,9 @@ int main(int argc, char *argv[]) /* We assume we've been called as 'openssl cmd' */ argc--; argv++; + opt_appname(argv[0]); + } else { + argv[0] = pname; } /* If there's a command, run with that, otherwise "help". */ @@ -360,7 +355,7 @@ int help_main(int argc, char **argv) } calculate_columns(functions, &dc); - BIO_printf(bio_err, "Standard commands"); + BIO_printf(bio_err, "%s:\n\nStandard commands", prog); i = 0; tp = FT_none; for (fp = functions; fp->name != NULL; fp++) { |