diff options
author | Rob Austein <sra@hactrn.net> | 2016-10-16 16:17:54 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2016-10-16 16:17:54 -0400 |
commit | 4ebe93221c31e5bebe3cf3aea24c5ac909b9ce2a (patch) | |
tree | 1f371365ea5828707845050c924024972d1e2120 /ks_index.c | |
parent | 534f465c5934c53c8f330e5f6227cc918151169f (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.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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; |