From: Amitay Isaacs Date: Tue, 19 Apr 2016 06:01:05 +0000 (+1000) Subject: ctdb-client: Fix ctdb_rec_buffer traversal routine X-Git-Tag: tdb-1.3.10~515 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5ce8ac85c7f7fbec8d8b4345e223a5c2c953976d;p=thirdparty%2Fsamba.git 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 Reviewed-by: Martin Schwenke --- 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; }