diff --git a/tool/yubico-piv-tool.c b/tool/yubico-piv-tool.c index cd86a92..bbae054 100644 --- a/tool/yubico-piv-tool.c +++ b/tool/yubico-piv-tool.c @@ -951,6 +951,7 @@ out: int main(int argc, char *argv[]) { struct gengetopt_args_info args_info; + struct gengetopt_args_info args_info_tmp; ykpiv_state *state; int verbosity; enum enum_action action; @@ -961,6 +962,8 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } + args_info_tmp = args_info; + verbosity = args_info.verbose_arg + (int)args_info.verbose_given; if(ykpiv_init(&state, verbosity) != YKPIV_OK) { @@ -973,9 +976,9 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - for(i = 0; i < args_info.action_given; i++) { + for(i = 0; i < args_info_tmp.action_given; i++) { bool needs_auth = false; - action = *args_info.action_arg++; + action = *args_info_tmp.action_arg++; switch(action) { case action_arg_generate: case action_arg_setMINUS_mgmMINUS_key: