aboutsummaryrefslogtreecommitdiff
path: root/ks_index.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-10-16 16:17:54 -0400
committerRob Austein <sra@hactrn.net>2016-10-16 16:17:54 -0400
commit4ebe93221c31e5bebe3cf3aea24c5ac909b9ce2a (patch)
tree1f371365ea5828707845050c924024972d1e2120 /ks_index.c
parent534f465c5934c53c8f330e5f6227cc918151169f (diff)
Debug keystore attribute code; handle name properly in ks_index_replace().
hal_rpc_pkey_match() still untested.
Diffstat (limited to 'ks_index.c')
-rw-r--r--ks_index.c12
1 files changed, 8 insertions, 4 deletions
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;