diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2023-01-27 14:31:45 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-02-02 08:58:10 +0100 |
commit | 323c47532ea7fc79d5e28a0fa58ea0cc4d5196b8 (patch) | |
tree | 0736fe1860ae5bbf2324be354fcff733b248cc85 /apps | |
parent | fedab100a4b8f4c3b81de632f29c159fb46ac3f2 (diff) | |
download | openssl-new-323c47532ea7fc79d5e28a0fa58ea0cc4d5196b8.tar.gz |
APPS/{storeutl,gendsa}: give error on extra arguments, improve doc
Point out that options must be given before the final file/URI arg.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20156)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lib/opt.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/lib/opt.c b/apps/lib/opt.c index df9152d77b..338a5a8674 100644 --- a/apps/lib/opt.c +++ b/apps/lib/opt.c @@ -1054,8 +1054,13 @@ int opt_check_rest_arg(const char *expected) opt_printf_stderr("%s: Missing argument: %s\n", prog, expected); return 0; } - if (expected != NULL) - return 1; + if (expected != NULL) { + opt = argv[opt_index + 1]; + if (opt == NULL || *opt == '\0') + return 1; + opt_printf_stderr("%s: Extra argument after %s: \"%s\"\n", prog, expected, opt); + return 0; + } if (opt_unknown() == NULL) opt_printf_stderr("%s: Extra option: \"%s\"\n", prog, opt); else |