From 4218d574d718255f5f180d8d13bde450ffa5b548 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 19 Feb 2007 11:45:33 +0000 Subject: r21445: Apply tdb_parse_record Tridges error return, merge to 3_0_25 and 4_0 (This used to be commit c852d9b56971673fc62eec3460720478d81c279d) --- source3/tdb/common/tdb.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'source3/tdb/common/tdb.c') diff --git a/source3/tdb/common/tdb.c b/source3/tdb/common/tdb.c index 008b168734..bf4c01d1b3 100644 --- a/source3/tdb/common/tdb.c +++ b/source3/tdb/common/tdb.c @@ -183,19 +183,14 @@ int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key, { tdb_off_t rec_ptr; struct list_struct rec; - TDB_DATA data; int ret; u32 hash; /* find which hash bucket it is in */ hash = tdb->hash_fn(&key); - rec_ptr = tdb_find_lock_hash(tdb,key,hash,F_RDLCK,&rec); - - if (rec_ptr == 0) { - data.dptr = NULL; - data.dsize = 0; - return parser(key, data, private_data); + if (!(rec_ptr = tdb_find_lock_hash(tdb,key,hash,F_RDLCK,&rec))) { + return TDB_ERRCODE(TDB_ERR_NOEXIST, 0); } ret = tdb_parse_data(tdb, key, rec_ptr + sizeof(rec) + rec.key_len, @@ -204,9 +199,7 @@ int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key, tdb_unlock(tdb, BUCKET(rec.full_hash), F_RDLCK); return ret; - } - /* check if an entry in the database exists -- cgit