From 2b1452b2fc0573e09fedb7fbd8a5f8d278470b9c Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2011 18:40:31 +0930 Subject: tdb_transaction_commit: check returns for 0, not -1. TDB2 returns a negative error number on failure. This is compatible if we always check for != 0 instead of == -1. Signed-off-by: Rusty Russell --- source3/lib/dbwrap_tdb.c | 2 +- source3/lib/gencache.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/lib/dbwrap_tdb.c b/source3/lib/dbwrap_tdb.c index f8baa0aeca..fc2af28c83 100644 --- a/source3/lib/dbwrap_tdb.c +++ b/source3/lib/dbwrap_tdb.c @@ -323,7 +323,7 @@ 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) == 0 ? 0 : -1; } static int db_tdb_transaction_cancel(struct db_context *db) diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index 5c9c1a296a..62bad96fbb 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -461,7 +461,7 @@ bool gencache_stabilize(void) } res = tdb_transaction_start_nonblock(cache); - if (res == -1) { + if (res != 0) { if (tdb_error(cache) == TDB_ERR_NOLOCK) { /* @@ -476,7 +476,7 @@ bool gencache_stabilize(void) return false; } res = tdb_transaction_start(cache_notrans); - if (res == -1) { + if (res != 0) { tdb_transaction_cancel(cache); DEBUG(10, ("Could not start transaction on " "gencache_notrans.tdb: %s\n", @@ -505,7 +505,7 @@ bool gencache_stabilize(void) } res = tdb_transaction_commit(cache); - if (res == -1) { + if (res != 0) { DEBUG(10, ("tdb_transaction_commit on gencache.tdb failed: " "%s\n", tdb_errorstr(cache))); if (tdb_transaction_cancel(cache_notrans) == -1) { @@ -515,7 +515,7 @@ bool gencache_stabilize(void) } res = tdb_transaction_commit(cache_notrans); - if (res == -1) { + if (res != 0) { DEBUG(10, ("tdb_transaction_commit on gencache.tdb failed: " "%s\n", tdb_errorstr(cache))); return false; -- cgit