Rev 166: fixed a bug found by volker - initialse the record on disk when initialised in memory in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Thu Apr 19 08:31:49 GMT 2007


------------------------------------------------------------
revno: 166
revision-id: tridge at samba.org-20070419083149-bc28d74eb9e5df7b
parent: tridge at samba.org-20070419074327-cdc474844a1e1d90
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Thu 2007-04-19 18:31:49 +1000
message:
  fixed a bug found by volker - initialse the record on disk when initialised in memory
modified:
  common/ctdb_ltdb.c             ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2
=== modified file 'common/ctdb_ltdb.c'
--- a/common/ctdb_ltdb.c	2007-04-19 07:43:27 +0000
+++ b/common/ctdb_ltdb.c	2007-04-19 08:31:49 +0000
@@ -156,13 +156,15 @@
 
 	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;
 	}
 



More information about the samba-cvs mailing list