aboutsummaryrefslogtreecommitdiff
path: root/rpc_misc.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2017-04-25 17:14:40 -0400
committerRob Austein <sra@hactrn.net>2017-04-25 17:14:40 -0400
commit358b3803cdedad607cf649221d0b7e3ce66b45f2 (patch)
tree9bb11b6b11d9bf9d28797c36c8b161f0702d2fb0 /rpc_misc.c
parent4ee44177c6da04e210a52528763b2c96a8f3d824 (diff)
Shake dumb compile-time bugs out of new logout code.
What I get for writing code while build and test environment is tied up with a multi-day run testing something else.
Diffstat (limited to 'rpc_misc.c')
-rw-r--r--rpc_misc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/rpc_misc.c b/rpc_misc.c
index 4db6ed3..e9ff4c6 100644
--- a/rpc_misc.c
+++ b/rpc_misc.c
@@ -110,7 +110,8 @@ static inline client_slot_t *alloc_slot(const hal_client_handle_t client,
#if HAL_STATIC_CLIENT_STATE_BLOCKS > 0
for (int i = 0; slot == NULL && i < sizeof(client_handle)/sizeof(*client_handle); i++)
- if (client_handle[i].logged_in != HAL_USER_NONE && client_handle[i].handle.handle == handle.handle)
+ if (client_handle[i].logged_in != HAL_USER_NONE &&
+ client_handle[i].handle.handle == client.handle)
slot = &client_handle[i];
for (int i = 0; slot == NULL && i < sizeof(client_handle)/sizeof(*client_handle); i++)
@@ -128,18 +129,23 @@ static inline client_slot_t *alloc_slot(const hal_client_handle_t client,
return slot;
}
-static inline void clear_slot(client_slot_t *slot)
+static inline hal_error_t clear_slot(client_slot_t *slot)
{
if (slot == NULL)
- return;
+ return HAL_OK;
+
+ hal_error_t err;
- hal_pkey_logout(slot->handle);
+ if ((err = hal_pkey_logout(slot->handle)) != HAL_OK)
+ return err;
hal_critical_section_start();
memset(slot, 0, sizeof(*slot));
hal_critical_section_end();
+
+ return HAL_OK;
}
static inline client_slot_t *find_handle(const hal_client_handle_t handle)