diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-07-28 09:06:43 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-01 13:54:57 +0200 |
commit | 3ed9fb8eed74721a9a6787f913182e3f25cfd5f9 (patch) | |
tree | b0261917f38105dc649c9ef6cb7f429963f682ac | |
parent | 3c7f63f94f898768af8fb79baaf001b21e682675 (diff) | |
download | libnitrokey-3ed9fb8eed74721a9a6787f913182e3f25cfd5f9.tar.gz libnitrokey-3ed9fb8eed74721a9a6787f913182e3f25cfd5f9.tar.bz2 |
Clear last command status code on success
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r-- | NK_C_API.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc index 1e5da56..e07d518 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -15,6 +15,7 @@ template <typename T> uint8_t * get_with_array_result(T func){ try { return func(); + NK_last_command_status = 0; } catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; @@ -26,6 +27,7 @@ template <typename T> const char* get_with_string_result(T func){ try { return func(); + NK_last_command_status = 0; } catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; @@ -37,6 +39,7 @@ template <typename T> auto get_with_result(T func){ try { return func(); + NK_last_command_status = 0; } catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; @@ -48,6 +51,7 @@ template <typename T> uint8_t get_without_result(T func){ try { func(); + NK_last_command_status = 0; return 0; } catch (CommandFailedException & commandFailedException){ @@ -69,6 +73,7 @@ extern int NK_login(const char *admin_pin, const char *temporary_password) { try { m->connect(); m->first_authenticate(admin_pin, temporary_password); + NK_last_command_status = 0; } catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; |