summaryrefslogtreecommitdiffstats
path: root/lib/tdb/common
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-03-18 07:52:59 +0100
committerMichael Adam <obnox@samba.org>2014-03-18 13:42:10 +0100
commitcb09d7937c93a6cdf855b84bd5f58f30a46cbfc7 (patch)
treee1e7a7599ff05372130b5364ebd3184f07221a0f /lib/tdb/common
parent255edd1b417480ab033c51165702c19fb5fff56f (diff)
downloadsamba-cb09d7937c93a6cdf855b84bd5f58f30a46cbfc7.tar.gz
samba-cb09d7937c93a6cdf855b84bd5f58f30a46cbfc7.tar.xz
samba-cb09d7937c93a6cdf855b84bd5f58f30a46cbfc7.zip
tdb: Move adding tailer space to tdb_find_dead
This aligns the tdb_find_dead API with the tdb_allocate API and thus makes it a bit easier to understand, at least for me. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib/tdb/common')
-rw-r--r--lib/tdb/common/tdb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/tdb/common/tdb.c b/lib/tdb/common/tdb.c
index 8242d2bb3fd..742680aab3b 100644
--- a/lib/tdb/common/tdb.c
+++ b/lib/tdb/common/tdb.c
@@ -452,6 +452,8 @@ static tdb_off_t tdb_find_dead(struct tdb_context *tdb, uint32_t hash,
tdb_off_t best_rec_ptr = 0;
struct tdb_record best = { .rec_len = UINT32_MAX };
+ length += sizeof(tdb_off_t); /* tailer */
+
/* read in the hash top */
if (tdb_ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1)
return 0;
@@ -518,9 +520,8 @@ static int _tdb_store(struct tdb_context *tdb, TDB_DATA key,
* for key, data and tailer. If we find one, we don't have to
* consult the central freelist.
*/
- rec_ptr = tdb_find_dead(
- tdb, hash, &rec,
- key.dsize + dbuf.dsize + sizeof(tdb_off_t));
+ rec_ptr = tdb_find_dead(tdb, hash, &rec,
+ key.dsize + dbuf.dsize);
if (rec_ptr != 0) {
rec.key_len = key.dsize;