From 249d7bab417a51fbdc1b84c5d84aa81ccdb3e94b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 6 Jan 2010 00:37:21 +0100 Subject: [PATCH] s3:dbwrap_ctdb: fix logic error in pull_newest_from_marshall_buffer(). The logic bug was that if a record was found in the marshall buffer, then always the ctdb header of tha last record in the marshall buffer was returned, and not the ctdb header of the last occurrence of the requested record. This is fixed by introducing an additional temporary variable. Michael (cherry picked from commit 524072b56bf659002410a817749bf86fe6f51e83) (cherry picked from commit e5cc0e718863d6cfaa59fbb4cac7d9b70fba0381) --- source3/lib/dbwrap_ctdb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c index d6fde3560d5..4e97d26ae82 100644 --- a/source3/lib/dbwrap_ctdb.c +++ b/source3/lib/dbwrap_ctdb.c @@ -403,8 +403,11 @@ static bool pull_newest_from_marshall_buffer(struct ctdb_marshall_buffer *buf, for (i=0; icount; i++) { TDB_DATA tkey, tdata; uint32_t reqid; + struct ctdb_ltdb_header hdr; - rec = db_ctdb_marshall_loop_next(buf, rec, &reqid, &h, &tkey, + ZERO_STRUCT(hdr); + + rec = db_ctdb_marshall_loop_next(buf, rec, &reqid, &hdr, &tkey, &tdata); if (rec == NULL) { return false; @@ -413,6 +416,7 @@ static bool pull_newest_from_marshall_buffer(struct ctdb_marshall_buffer *buf, if (tdb_data_equal(key, tkey)) { found = true; data = tdata; + h = hdr; } } -- 2.11.4.GIT