From 931d224485ad197ba4ef85b76777ea96cf3471e2 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Thu, 2 Oct 2014 12:35:27 +0200 Subject: [PATCH] use temporary args_info for parsing if auth is needed --- tool/yubico-piv-tool.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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: