summaryrefslogtreecommitdiff
path: root/ctdb/client
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2016-04-19 16:01:05 +1000
committerMartin Schwenke <martins@samba.org>2016-07-05 10:53:14 +0200
commit5ce8ac85c7f7fbec8d8b4345e223a5c2c953976d (patch)
tree59bafc6ec0ecbaa60b2b9de09b5d94596656d014 /ctdb/client
parent3da13a886ddbc789a618ba909552241fda5ffce9 (diff)
downloadsamba-5ce8ac85c7f7fbec8d8b4345e223a5c2c953976d.tar.gz
ctdb-client: Fix ctdb_rec_buffer traversal routine
In commit 1ee7053180057ea526870182b5619a206b4d103b, the ctdb_rec_buffer_traverse always passes NULL for header. So explicitly extract header from the data. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb/client')
-rw-r--r--ctdb/client/client_db.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/ctdb/client/client_db.c b/ctdb/client/client_db.c
index 85d14e3fce3..4bc30fcd6bd 100644
--- a/ctdb/client/client_db.c
+++ b/ctdb/client/client_db.c
@@ -1802,19 +1802,26 @@ struct ctdb_transaction_record_fetch_state {
bool found;
};
-static int ctdb_transaction_record_fetch_traverse(uint32_t reqid,
- struct ctdb_ltdb_header *header,
- TDB_DATA key,
- TDB_DATA data,
- void *private_data)
+static int ctdb_transaction_record_fetch_traverse(
+ uint32_t reqid,
+ struct ctdb_ltdb_header *nullheader,
+ TDB_DATA key, TDB_DATA data,
+ void *private_data)
{
struct ctdb_transaction_record_fetch_state *state =
(struct ctdb_transaction_record_fetch_state *)private_data;
if (state->key.dsize == key.dsize &&
memcmp(state->key.dptr, key.dptr, key.dsize) == 0) {
+ int ret;
+
+ ret = ctdb_ltdb_header_extract(&data, &state->header);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR, ("Failed to extract header\n"));
+ return 1;
+ }
+
state->data = data;
- state->header = *header;
state->found = true;
}