From 5e0f62c3c20250a7fdb4be11f08bd407b11a204b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 14 Sep 2011 08:13:28 +0930 Subject: [PATCH] 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 --- source3/lib/dbwrap/dbwrap_tdb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c index f3528a98c1a..a861974fb6e 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) -- 2.11.4.GIT