From c8aaf1a65e70b43bec18027ac916b4e8017139b3 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Thu, 2 Oct 2014 13:20:34 +0200 Subject: [PATCH] don't change the action_arg pointer, add to it in place instead this effectively reverses 931d224485ad197ba4ef85b76777ea96cf3471e2 --- tool/yubico-piv-tool.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tool/yubico-piv-tool.c b/tool/yubico-piv-tool.c index d6f2c1e..fca1a33 100644 --- a/tool/yubico-piv-tool.c +++ b/tool/yubico-piv-tool.c @@ -1072,7 +1072,6 @@ 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; @@ -1083,8 +1082,6 @@ 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) { @@ -1097,9 +1094,9 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - for(i = 0; i < args_info_tmp.action_given; i++) { + for(i = 0; i < args_info.action_given; i++) { bool needs_auth = false; - action = *args_info_tmp.action_arg++; + action = *(args_info.action_arg + i); switch(action) { case action_arg_generate: case action_arg_setMINUS_mgmMINUS_key: @@ -1144,7 +1141,7 @@ int main(int argc, char *argv[]) { OpenSSL_add_all_algorithms(); for(i = 0; i < args_info.action_given; i++) { - action = *args_info.action_arg++; + action = *(args_info.action_arg + i); if(verbosity) { fprintf(stderr, "Now processing for action %d.\n", action); }