diff options
author | Volker Lendecke <vl@samba.org> | 2010-02-27 19:26:01 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2010-02-28 17:40:59 +0100 |
commit | fb98f60594b6cabc52d0f2f49eda08f793ba4748 (patch) | |
tree | aeb54dd0f76da067561d17e8a8f27f19963ff021 /lib/tdb/common | |
parent | 0e9882a65e91e4ab55dc103c7f6aec4ccd966db0 (diff) | |
download | samba-fb98f60594b6cabc52d0f2f49eda08f793ba4748.tar.gz samba-fb98f60594b6cabc52d0f2f49eda08f793ba4748.tar.bz2 samba-fb98f60594b6cabc52d0f2f49eda08f793ba4748.zip |
tdb: If tdb_parse_record does not find a record, return -1 instead of 0
Diffstat (limited to 'lib/tdb/common')
-rw-r--r-- | lib/tdb/common/tdb.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/tdb/common/tdb.c b/lib/tdb/common/tdb.c index 7317a3aa52..953c811c70 100644 --- a/lib/tdb/common/tdb.c +++ b/lib/tdb/common/tdb.c @@ -222,6 +222,8 @@ TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key) * * This is interesting for all readers of potentially large data structures in * the tdb records, ldb indexes being one example. + * + * Return -1 if the record was not found. */ int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key, @@ -238,9 +240,10 @@ int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key, hash = tdb->hash_fn(&key); if (!(rec_ptr = tdb_find_lock_hash(tdb,key,hash,F_RDLCK,&rec))) { + /* record not found */ tdb_trace_1rec_ret(tdb, "tdb_parse_record", key, -1); tdb->ecode = TDB_ERR_NOEXIST; - return 0; + return -1; } tdb_trace_1rec_ret(tdb, "tdb_parse_record", key, 0); |