aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-registry
diff options
context:
space:
mode:
Diffstat (limited to 'src/mds-registry')
-rw-r--r--src/mds-registry/registry.c3
-rw-r--r--src/mds-registry/slave.c21
2 files changed, 11 insertions, 13 deletions
diff --git a/src/mds-registry/registry.c b/src/mds-registry/registry.c
index b13c7b4..4a35975 100644
--- a/src/mds-registry/registry.c
+++ b/src/mds-registry/registry.c
@@ -383,7 +383,8 @@ static int list_registry(const char* recv_client_id, const char* recv_message_id
/* Send message. */
fail_if (full_send(send_buffer + ptr, strlen(send_buffer + ptr)));
- return full_send(send_buffer, ptr);
+ fail_if (full_send(send_buffer, ptr));
+ return 0;
fail:
return -1;
}
diff --git a/src/mds-registry/slave.c b/src/mds-registry/slave.c
index 5e496f5..a8a23b6 100644
--- a/src/mds-registry/slave.c
+++ b/src/mds-registry/slave.c
@@ -431,15 +431,13 @@ size_t slave_unmarshal(slave_t* restrict this, char* restrict data)
buf_get_next(data, time_t, this->dethklok.tv_sec);
buf_get_next(data, long, this->dethklok.tv_nsec);
- n = (strlen((char*)data) + 1) * sizeof(char);
- fail_if (xbmalloc(this->client_id, n));
- memcpy(this->client_id, data, n);
- data += n, rc += n;
+ n = strlen((char*)data) + 1;
+ fail_if (xmemdup(this->client_id, data, n, char));
+ data += n, rc += n * sizeof(char);
- n = (strlen((char*)data) + 1) * sizeof(char);
- fail_if (xbmalloc(this->message_id, n));
- memcpy(this->message_id, data, n);
- data += n, rc += n;
+ n = strlen((char*)data) + 1;
+ fail_if (xmemdup(this->message_id, data, n, char));
+ data += n, rc += n * sizeof(char);
fail_if (xmalloc(this->wait_set, 1, hash_table_t));
fail_if (hash_table_create(this->wait_set));
@@ -448,10 +446,9 @@ size_t slave_unmarshal(slave_t* restrict this, char* restrict data)
while (m--)
{
- n = (strlen((char*)data) + 1) * sizeof(char);
- fail_if (xbmalloc(protocol, n));
- memcpy(protocol, data, n);
- data += n, rc += n;
+ n = strlen((char*)data) + 1;
+ fail_if (xmemdup(protocol, data, n, char));
+ data += n, rc += n * sizeof(char);
key = (size_t)(void*)protocol;
if (hash_table_put(this->wait_set, key, 1) == 0)