1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

r21445: Apply tdb_parse_record Tridges error return, merge to 3_0_25 and 4_0

(This used to be commit c852d9b56971673fc62eec3460720478d81c279d)
This commit is contained in:
Volker Lendecke 2007-02-19 11:45:33 +00:00 committed by Gerald (Jerry) Carter
parent 39c1ebff22
commit 4218d574d7

View File

@ -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