Fix return error in tdb_parse_record?

tridge at samba.org tridge at samba.org
Thu Feb 25 06:24:51 MST 2010


Hi Volker,

 > diff --git a/lib/tdb/common/tdb.c b/lib/tdb/common/tdb.c
 > index d2688de..f7a7fc0 100644
 > --- a/lib/tdb/common/tdb.c
 > +++ b/lib/tdb/common/tdb.c
 > @@ -239,7 +239,7 @@ int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key,
 >  	if (!(rec_ptr = tdb_find_lock_hash(tdb,key,hash,F_RDLCK,&rec))) {
 >  		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);

I think -1 is a better return code for failure for this function, even
though tdb uses 0 in some cases, and -1 in others (due to attempts to
be compatible with gdbm, which tdb was modelled on).

So please change it to -1, but add a comment, and can you also update
docs/README to add this function in? 

Cheers, Tridge


More information about the samba-technical mailing list