From 3acce707a32a28c309133583b8cd1a554f19a8b3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 26 Mar 2012 14:33:17 +1030 Subject: tdb2: fix prototype in tdb1 code. We were handing an int-returning function where we should hand an enum TDB_ERROR returning function. Worse, it was returning 0/-1 instead of 0/TDB_ERR_*. Fortunately, it's only compared against success, but the Solaris compiler warns about it, and it's not correct anyway. Signed-off-by: Rusty Russell --- lib/tdb2/tdb1_tdb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/tdb2') diff --git a/lib/tdb2/tdb1_tdb.c b/lib/tdb2/tdb1_tdb.c index 869672a578..ae633ed77b 100644 --- a/lib/tdb2/tdb1_tdb.c +++ b/lib/tdb2/tdb1_tdb.c @@ -146,17 +146,17 @@ tdb1_off_t tdb1_find_lock_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t h static TDB_DATA _tdb1_fetch(struct tdb_context *tdb, TDB_DATA key); -static int tdb_update_hash_cmp(TDB_DATA key, TDB_DATA data, void *private_data) +static enum TDB_ERROR tdb_update_hash_cmp(TDB_DATA key, TDB_DATA data, void *private_data) { TDB_DATA *dbuf = (TDB_DATA *)private_data; if (dbuf->dsize != data.dsize) { - return -1; + return TDB_ERR_EINVAL; } if (memcmp(dbuf->dptr, data.dptr, data.dsize) != 0) { - return -1; + return TDB_ERR_EINVAL; } - return 0; + return TDB_SUCCESS; } /* update an entry in place - this only works if the new data size @@ -177,7 +177,7 @@ static int tdb1_update_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash if (rec.key_len == key.dsize && rec.data_len == dbuf.dsize && rec.full_hash == hash && - tdb1_parse_record(tdb, key, tdb_update_hash_cmp, &dbuf) == 0) { + tdb1_parse_record(tdb, key, tdb_update_hash_cmp, &dbuf) == TDB_SUCCESS) { return 0; } -- cgit