summaryrefslogtreecommitdiff
path: root/lib/tdb2/tdb1_transaction.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 08:13:27 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 08:13:27 +0930
commit2237daed7e4c6c38241bc07383ed1a421abe8d6c (patch)
tree11495936fbf2306d4e443bdf529ed71ff8e9f23a /lib/tdb2/tdb1_transaction.c
parent45467c0118da0c1d4e5644f4570f10aafe37a8a7 (diff)
downloadsamba-2237daed7e4c6c38241bc07383ed1a421abe8d6c.tar.gz
samba-2237daed7e4c6c38241bc07383ed1a421abe8d6c.tar.bz2
samba-2237daed7e4c6c38241bc07383ed1a421abe8d6c.zip
tdb2: add error conversion functions.
This clarifies the code a little, but also provides a more explicit mechanism which can be used to debug error handling (by introducing tdb_err_t and making it a pointer type). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit afa6d57b7d93fe4675a952f556eb462951baa257)
Diffstat (limited to 'lib/tdb2/tdb1_transaction.c')
-rw-r--r--lib/tdb2/tdb1_transaction.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/tdb2/tdb1_transaction.c b/lib/tdb2/tdb1_transaction.c
index 157642a632..411caef360 100644
--- a/lib/tdb2/tdb1_transaction.c
+++ b/lib/tdb2/tdb1_transaction.c
@@ -1318,7 +1318,7 @@ tdb_bool_err tdb1_needs_recovery(struct tdb_context *tdb)
/* find the recovery area */
if (tdb1_ofs_read(tdb, TDB1_RECOVERY_HEAD, &recovery_head) == -1) {
- return tdb->last_error;
+ return TDB_ERR_TO_OFF(tdb->last_error);
}
if (recovery_head == 0) {
@@ -1329,7 +1329,7 @@ tdb_bool_err tdb1_needs_recovery(struct tdb_context *tdb)
/* read the recovery record */
if (tdb->tdb1.io->tdb1_read(tdb, recovery_head, &rec,
sizeof(rec), TDB1_DOCONV()) == -1) {
- return tdb->last_error;
+ return TDB_ERR_TO_OFF(tdb->last_error);
}
return (rec.magic == TDB1_RECOVERY_MAGIC);