提交 03358517 编写于 作者: K Kurt Roeckx

argv was set but unused

Also gives an error message when you gave it a parameter it didn't expect.
Reviewed-by: NRich Salz <rsalz@openssl.org>

MR: #2009
上级 5ee719da
...@@ -184,7 +184,8 @@ int asn1parse_main(int argc, char **argv) ...@@ -184,7 +184,8 @@ int asn1parse_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
if (oidfile != NULL) { if (oidfile != NULL) {
in = bio_open_default(oidfile, 'r', FORMAT_TEXT); in = bio_open_default(oidfile, 'r', FORMAT_TEXT);
......
...@@ -227,7 +227,8 @@ int crl_main(int argc, char **argv) ...@@ -227,7 +227,8 @@ int crl_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
if (!nmflag_set) if (!nmflag_set)
nmflag = XN_FLAG_ONELINE; nmflag = XN_FLAG_ONELINE;
......
...@@ -146,7 +146,8 @@ int crl2pkcs7_main(int argc, char **argv) ...@@ -146,7 +146,8 @@ int crl2pkcs7_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
if (!nocrl) { if (!nocrl) {
in = bio_open_default(infile, 'r', informat); in = bio_open_default(infile, 'r', informat);
......
...@@ -194,7 +194,9 @@ int dsa_main(int argc, char **argv) ...@@ -194,7 +194,9 @@ int dsa_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
private = pubin || pubout ? 0 : 1; private = pubin || pubout ? 0 : 1;
if (text && !pubin) if (text && !pubin)
private = 1; private = 1;
......
...@@ -205,7 +205,9 @@ int ec_main(int argc, char **argv) ...@@ -205,7 +205,9 @@ int ec_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
private = param_out || pubin || pubout ? 0 : 1; private = param_out || pubin || pubout ? 0 : 1;
if (text && !pubin) if (text && !pubin)
private = 1; private = 1;
......
...@@ -220,7 +220,9 @@ int ecparam_main(int argc, char **argv) ...@@ -220,7 +220,9 @@ int ecparam_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
private = genkey ? 1 : 0; private = genkey ? 1 : 0;
in = bio_open_default(infile, 'r', informat); in = bio_open_default(infile, 'r', informat);
......
...@@ -170,7 +170,9 @@ int genpkey_main(int argc, char **argv) ...@@ -170,7 +170,9 @@ int genpkey_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
private = do_param ? 0 : 1; private = do_param ? 0 : 1;
if (ctx == NULL) if (ctx == NULL)
......
...@@ -89,6 +89,7 @@ int nseq_main(int argc, char **argv) ...@@ -89,6 +89,7 @@ int nseq_main(int argc, char **argv)
switch (o) { switch (o) {
case OPT_EOF: case OPT_EOF:
case OPT_ERR: case OPT_ERR:
opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end; goto end;
case OPT_HELP: case OPT_HELP:
...@@ -107,7 +108,8 @@ int nseq_main(int argc, char **argv) ...@@ -107,7 +108,8 @@ int nseq_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
in = bio_open_default(infile, 'r', FORMAT_PEM); in = bio_open_default(infile, 'r', FORMAT_PEM);
if (in == NULL) if (in == NULL)
......
...@@ -491,7 +491,8 @@ int ocsp_main(int argc, char **argv) ...@@ -491,7 +491,8 @@ int ocsp_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
/* Have we anything to do? */ /* Have we anything to do? */
if (!req && !reqin && !respin && !(port && ridx_filename)) if (!req && !reqin && !respin && !(port && ridx_filename))
......
...@@ -325,7 +325,9 @@ int pkcs12_main(int argc, char **argv) ...@@ -325,7 +325,9 @@ int pkcs12_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
private = 1; private = 1;
if (passarg) { if (passarg) {
......
...@@ -191,7 +191,8 @@ int pkcs7_main(int argc, char **argv) ...@@ -191,7 +191,8 @@ int pkcs7_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
in = bio_open_default(infile, 'r', informat); in = bio_open_default(infile, 'r', informat);
if (in == NULL) if (in == NULL)
......
...@@ -225,7 +225,9 @@ int pkcs8_main(int argc, char **argv) ...@@ -225,7 +225,9 @@ int pkcs8_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
private = 1; private = 1;
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) { if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {
......
...@@ -159,7 +159,9 @@ int pkey_main(int argc, char **argv) ...@@ -159,7 +159,9 @@ int pkey_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
private = !noout && !pubout ? 1 : 0; private = !noout && !pubout ? 1 : 0;
if (text && !pubtext) if (text && !pubtext)
private = 1; private = 1;
......
...@@ -92,6 +92,7 @@ int pkeyparam_main(int argc, char **argv) ...@@ -92,6 +92,7 @@ int pkeyparam_main(int argc, char **argv)
switch (o) { switch (o) {
case OPT_EOF: case OPT_EOF:
case OPT_ERR: case OPT_ERR:
opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end; goto end;
case OPT_HELP: case OPT_HELP:
...@@ -116,7 +117,8 @@ int pkeyparam_main(int argc, char **argv) ...@@ -116,7 +117,8 @@ int pkeyparam_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
in = bio_open_default(infile, 'r', FORMAT_PEM); in = bio_open_default(infile, 'r', FORMAT_PEM);
if (in == NULL) if (in == NULL)
......
...@@ -225,7 +225,8 @@ int pkeyutl_main(int argc, char **argv) ...@@ -225,7 +225,8 @@ int pkeyutl_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
if (inkey == NULL || if (inkey == NULL ||
(peerkey != NULL && pkey_op != EVP_PKEY_OP_DERIVE)) (peerkey != NULL && pkey_op != EVP_PKEY_OP_DERIVE))
......
...@@ -367,7 +367,8 @@ int req_main(int argc, char **argv) ...@@ -367,7 +367,8 @@ int req_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
if (!nmflag_set) if (!nmflag_set)
nmflag = XN_FLAG_ONELINE; nmflag = XN_FLAG_ONELINE;
......
...@@ -252,7 +252,9 @@ int rsa_main(int argc, char **argv) ...@@ -252,7 +252,9 @@ int rsa_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
private = (text && !pubin) || (!pubout && !noout) ? 1 : 0; private = (text && !pubin) || (!pubout && !noout) ? 1 : 0;
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) { if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {
......
...@@ -205,7 +205,8 @@ int rsautl_main(int argc, char **argv) ...@@ -205,7 +205,8 @@ int rsautl_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
if (need_priv && (key_type != KEY_PRIVKEY)) { if (need_priv && (key_type != KEY_PRIVKEY)) {
BIO_printf(bio_err, "A private key is needed for this operation\n"); BIO_printf(bio_err, "A private key is needed for this operation\n");
......
...@@ -1341,7 +1341,8 @@ int s_client_main(int argc, char **argv) ...@@ -1341,7 +1341,8 @@ int s_client_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
if (proxystr) { if (proxystr) {
int res; int res;
......
...@@ -237,7 +237,8 @@ int s_time_main(int argc, char **argv) ...@@ -237,7 +237,8 @@ int s_time_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
if (cipher == NULL) if (cipher == NULL)
cipher = getenv("SSL_CIPHER"); cipher = getenv("SSL_CIPHER");
......
...@@ -139,7 +139,8 @@ int sess_id_main(int argc, char **argv) ...@@ -139,7 +139,8 @@ int sess_id_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
x = load_sess_id(infile, informat); x = load_sess_id(infile, informat);
if (x == NULL) { if (x == NULL) {
......
...@@ -112,6 +112,7 @@ int spkac_main(int argc, char **argv) ...@@ -112,6 +112,7 @@ int spkac_main(int argc, char **argv)
switch (o) { switch (o) {
case OPT_EOF: case OPT_EOF:
case OPT_ERR: case OPT_ERR:
opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end; goto end;
case OPT_HELP: case OPT_HELP:
...@@ -154,7 +155,8 @@ int spkac_main(int argc, char **argv) ...@@ -154,7 +155,8 @@ int spkac_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); if (argc != 0)
goto opthelp;
if (!app_passwd(passinarg, NULL, &passin, NULL)) { if (!app_passwd(passinarg, NULL, &passin, NULL)) {
BIO_printf(bio_err, "Error getting password\n"); BIO_printf(bio_err, "Error getting password\n");
......
...@@ -299,7 +299,6 @@ int ts_main(int argc, char **argv) ...@@ -299,7 +299,6 @@ int ts_main(int argc, char **argv)
} }
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest();
if (mode == OPT_ERR || argc != 0) if (mode == OPT_ERR || argc != 0)
goto opthelp; goto opthelp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册