From: Andrew Tridgell Date: Thu, 19 Apr 2007 08:31:49 +0000 (+1000) Subject: fixed a bug found by volker - initialse the record on disk when initialised in memory X-Git-Tag: tevent-0.9.20~348^2~2865 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eabe0bd7d4f0c9a609b617e1b58b8ba5fcd23fb9;p=thirdparty%2Fsamba.git fixed a bug found by volker - initialse the record on disk when initialised in memory (This used to be ctdb commit f7903b00cdc91ae7d7e38b1a38d2b7b663e3a728) --- diff --git a/ctdb/common/ctdb_ltdb.c b/ctdb/common/ctdb_ltdb.c index d8c69c59c0b..cb07a72375b 100644 --- a/ctdb/common/ctdb_ltdb.c +++ b/ctdb/common/ctdb_ltdb.c @@ -156,13 +156,15 @@ int ctdb_ltdb_fetch(struct ctdb_db_context *ctdb_db, rec = tdb_fetch(ctdb_db->ltdb->tdb, key); if (rec.dsize < sizeof(*header)) { + TDB_DATA d2; /* return an initial header */ - free(rec.dptr); + if (rec.dptr) free(rec.dptr); ltdb_initial_header(ctdb_db, key, header); + ZERO_STRUCT(d2); if (data) { - data->dptr = NULL; - data->dsize = 0; + *data = d2; } + ctdb_ltdb_store(ctdb_db, key, header, d2); return 0; }