summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 08:13:28 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 08:13:28 +0930
commit5e0f62c3c20250a7fdb4be11f08bd407b11a204b (patch)
treeda40fa8a8cb94dbbd5c9b5b4843f15326d06010b
parent2d7c85a971b2766e5ad6ce3664506deba87b53e1 (diff)
downloadsamba-5e0f62c3c20250a7fdb4be11f08bd407b11a204b.tar.gz
samba-5e0f62c3c20250a7fdb4be11f08bd407b11a204b.tar.bz2
samba-5e0f62c3c20250a7fdb4be11f08bd407b11a204b.zip
dbwrap_tdb: handle tdb2 return values properly.
TDB2 versions of tdb_parse_record etc return an error code, not -1. Turn those into -1/0 in dbwrap_tdb to insulate the rest of the code from that change. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--source3/lib/dbwrap/dbwrap_tdb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c
index f3528a98c1..a861974fb6 100644
--- a/source3/lib/dbwrap/dbwrap_tdb.c
+++ b/source3/lib/dbwrap/dbwrap_tdb.c
@@ -168,7 +168,7 @@ static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
ret = tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetch_parse, &state);
- if (ret < 0) {
+ if (ret != 0) {
return -1;
}
@@ -188,7 +188,7 @@ static int db_tdb_parse(struct db_context *db, TDB_DATA key,
struct db_tdb_ctx *ctx = talloc_get_type_abort(
db->private_data, struct db_tdb_ctx);
- return tdb_parse_record(ctx->wtdb->tdb, key, parser, private_data);
+ return tdb_parse_record(ctx->wtdb->tdb, key, parser, private_data) ? -1 : 0;
}
static NTSTATUS db_tdb_store(struct db_record *rec, TDB_DATA data, int flag)
@@ -318,14 +318,14 @@ static int db_tdb_transaction_start(struct db_context *db)
{
struct db_tdb_ctx *db_ctx =
talloc_get_type_abort(db->private_data, struct db_tdb_ctx);
- return tdb_transaction_start(db_ctx->wtdb->tdb);
+ return tdb_transaction_start(db_ctx->wtdb->tdb) ? -1 : 0;
}
static int db_tdb_transaction_commit(struct db_context *db)
{
struct db_tdb_ctx *db_ctx =
talloc_get_type_abort(db->private_data, struct db_tdb_ctx);
- return tdb_transaction_commit(db_ctx->wtdb->tdb);
+ return tdb_transaction_commit(db_ctx->wtdb->tdb) ? -1 : 0;
}
static int db_tdb_transaction_cancel(struct db_context *db)