diff options
Diffstat (limited to '')
-rw-r--r-- | src/mds-server/client.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/mds-server/client.c b/src/mds-server/client.c index 99d561e..37ba906 100644 --- a/src/mds-server/client.c +++ b/src/mds-server/client.c @@ -203,6 +203,7 @@ size_t client_marshal(const client_t* restrict this, char* restrict data) size_t client_unmarshal(client_t* restrict this, char* restrict data) { size_t i, n, rc = sizeof(ssize_t) + 3 * sizeof(int) + sizeof(uint64_t) + 5 * sizeof(size_t); + int saved_errno; this->interception_conditions = NULL; this->multicasts = NULL; this->send_pending = NULL; @@ -223,35 +224,32 @@ size_t client_unmarshal(client_t* restrict this, char* restrict data) data += n / sizeof(char); rc += n; buf_get_next(data, size_t, this->interception_conditions_count); - if (xmalloc(this->interception_conditions, this->interception_conditions_count, interception_condition_t)) - goto fail; + fail_if (xmalloc(this->interception_conditions, + this->interception_conditions_count, interception_condition_t)); for (i = 0; i < this->interception_conditions_count; i++) { n = interception_condition_unmarshal(this->interception_conditions + i, data); if (n == 0) { this->interception_conditions_count = i - 1; - goto fail; + fail_if (1); } data += n / sizeof(char); rc += n; } buf_get_next(data, size_t, n); - if (xmalloc(this->multicasts, n, multicast_t)) - goto fail; + fail_if (xmalloc(this->multicasts, n, multicast_t)); for (i = 0; i < n; i++, this->multicasts_count++) { size_t m = multicast_unmarshal(this->multicasts + i, data); - if (m == 0) - goto fail; + fail_if (m == 0); data += m / sizeof(char); rc += m; } buf_get_next(data, size_t, this->send_pending_size); if (this->send_pending_size > 0) { - if (xmalloc(this->send_pending, this->send_pending_size, char)) - goto fail; + fail_if (xmalloc(this->send_pending, this->send_pending_size, char)); memcpy(this->send_pending, data, this->send_pending_size * sizeof(char)); data += this->send_pending_size; rc += this->send_pending_size * sizeof(char); @@ -264,7 +262,8 @@ size_t client_unmarshal(client_t* restrict this, char* restrict data) rc += n * sizeof(char); return rc; - fail: + pfail: + saved_errno = errno; mds_message_destroy(&(this->message)); for (i = 0; i < this->interception_conditions_count; i++) free(this->interception_conditions[i].condition); @@ -278,7 +277,7 @@ size_t client_unmarshal(client_t* restrict this, char* restrict data) mds_message_destroy(this->modify_message); free(this->modify_message); } - return 0; + return errno = saved_errno, (size_t)0; } /** |