From b77f41d58b05101e02d8ac0e54cb0e30807d89c2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 22 Oct 2009 00:09:43 +1030 Subject: lib/tdb: wean off TDB_ERRCODE. It was a regrettable hack which I used to reduce line count in tdb; in fact it caused confusion as can be seen in this patch. In particular, ecode now needs to be set before TDB_LOG anyway, and having it exposed in the header is useless (the struct tdb_context isn't defined, so it's doubly useless). Also, we should never set errno, as io.c was doing. Signed-off-by: Rusty Russell --- lib/tdb/common/freelist.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/tdb/common/freelist.c') diff --git a/lib/tdb/common/freelist.c b/lib/tdb/common/freelist.c index 3bc3965141..dedf78cf92 100644 --- a/lib/tdb/common/freelist.c +++ b/lib/tdb/common/freelist.c @@ -54,7 +54,7 @@ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct list_struct tdb->ecode = TDB_ERR_CORRUPT; TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_rec_free_read bad magic 0x%x at offset=%d\n", rec->magic, off)); - return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); + return -1; } if (tdb->methods->tdb_oob(tdb, rec->next+sizeof(*rec), 0) != 0) return -1; @@ -78,8 +78,9 @@ static int remove_from_freelist(struct tdb_context *tdb, tdb_off_t off, tdb_off_ /* Follow chain (next offset is at start of record) */ last_ptr = i; } + tdb->ecode = TDB_ERR_CORRUPT; TDB_LOG((tdb, TDB_DEBUG_FATAL,"remove_from_freelist: not on list at off=%d\n", off)); - return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); + return -1; } #endif -- cgit