From 4ebe93221c31e5bebe3cf3aea24c5ac909b9ce2a Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 16 Oct 2016 16:17:54 -0400 Subject: Debug keystore attribute code; handle name properly in ks_index_replace(). hal_rpc_pkey_match() still untested. --- ks_index.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ks_index.c') diff --git a/ks_index.c b/ks_index.c index 40238db..5bf2ce5 100644 --- a/ks_index.c +++ b/ks_index.c @@ -371,13 +371,17 @@ hal_error_t hal_ks_index_replace(hal_ks_index_t *ksi, */ const size_t len = (ksi->size - ksi->used - 1) * sizeof(*ksi->index); - const uint16_t b = ksi->index[ksi->used]; + const uint16_t b1 = ksi->index[where]; + const uint16_t b2 = ksi->index[ksi->used]; memmove(&ksi->index[ksi->used], &ksi->index[ksi->used + 1], len); - ksi->index[ksi->size - 1] = ksi->index[where]; - ksi->index[where] = b; + ksi->index[ksi->size - 1] = b1; + ksi->index[where] = b2; + ksi->names[b2].name = *name; + ksi->names[b2].chunk = chunk; + memset(&ksi->names[b1], 0, sizeof(ksi->names[b1])); if (blockno != NULL) - *blockno = b; + *blockno = b2; if (hint != NULL) *hint = where; -- cgit v1.2.3