diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-06-20 18:40:31 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-06-20 11:18:35 +0200 |
commit | d6251996fa5b8371c0f7449825b5d1788da95dd0 (patch) | |
tree | d2295fb5edffef971841c3220a6c1ce17af81808 | |
parent | 2b1452b2fc0573e09fedb7fbd8a5f8d278470b9c (diff) | |
download | samba-d6251996fa5b8371c0f7449825b5d1788da95dd0.tar.gz samba-d6251996fa5b8371c0f7449825b5d1788da95dd0.tar.bz2 samba-d6251996fa5b8371c0f7449825b5d1788da95dd0.zip |
tdb_transaction_cancel: ignore return value.
TDB2 returns void here. tdb_transaction_cancel will *always* return
with the transaction cancelled, but it will complain via the log
function if a transaction wasn't in progress.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | source3/lib/dbwrap_tdb.c | 3 | ||||
-rw-r--r-- | source3/lib/gencache.c | 16 | ||||
-rw-r--r-- | source3/lib/util_tdb.c | 8 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 5 |
4 files changed, 10 insertions, 22 deletions
diff --git a/source3/lib/dbwrap_tdb.c b/source3/lib/dbwrap_tdb.c index fc2af28c83..2ed368ee97 100644 --- a/source3/lib/dbwrap_tdb.c +++ b/source3/lib/dbwrap_tdb.c @@ -330,7 +330,8 @@ static int db_tdb_transaction_cancel(struct db_context *db) { struct db_tdb_ctx *db_ctx = talloc_get_type_abort(db->private_data, struct db_tdb_ctx); - return tdb_transaction_cancel(db_ctx->wtdb->tdb); + tdb_transaction_cancel(db_ctx->wtdb->tdb); + return 0; } struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index 62bad96fbb..ab7de21d92 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -489,18 +489,14 @@ bool gencache_stabilize(void) res = tdb_traverse(cache_notrans, stabilize_fn, &state); if ((res == -1) || state.error) { - if ((tdb_transaction_cancel(cache_notrans) == -1) - || (tdb_transaction_cancel(cache) == -1)) { - smb_panic("tdb_transaction_cancel failed\n"); - } + tdb_transaction_cancel(cache_notrans); + tdb_transaction_cancel(cache); return false; } if (!state.written) { - if ((tdb_transaction_cancel(cache_notrans) == -1) - || (tdb_transaction_cancel(cache) == -1)) { - smb_panic("tdb_transaction_cancel failed\n"); - } + tdb_transaction_cancel(cache_notrans); + tdb_transaction_cancel(cache); return true; } @@ -508,9 +504,7 @@ bool gencache_stabilize(void) if (res != 0) { DEBUG(10, ("tdb_transaction_commit on gencache.tdb failed: " "%s\n", tdb_errorstr(cache))); - if (tdb_transaction_cancel(cache_notrans) == -1) { - smb_panic("tdb_transaction_cancel failed\n"); - } + tdb_transaction_cancel(cache_notrans); return false; } diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index 5c3dc3a07d..f0fc8cd29b 100644 --- a/source3/lib/util_tdb.c +++ b/source3/lib/util_tdb.c @@ -442,9 +442,7 @@ int tdb_trans_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, if ((res = tdb_store(tdb, key, dbuf, flag)) != 0) { DEBUG(10, ("tdb_store failed\n")); - if (tdb_transaction_cancel(tdb) != 0) { - smb_panic("Cancelling transaction failed"); - } + tdb_transaction_cancel(tdb); return res; } @@ -471,9 +469,7 @@ int tdb_trans_delete(struct tdb_context *tdb, TDB_DATA key) if ((res = tdb_delete(tdb, key)) != 0) { DEBUG(10, ("tdb_delete failed\n")); - if (tdb_transaction_cancel(tdb) != 0) { - smb_panic("Cancelling transaction failed"); - } + tdb_transaction_cancel(tdb); return res; } diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 436ef46b33..77b4b24a2e 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -1073,10 +1073,7 @@ static int ltdb_del_trans(struct ldb_module *module) return ltdb_err_map(tdb_error(ltdb->tdb)); } - if (tdb_transaction_cancel(ltdb->tdb) != 0) { - return ltdb_err_map(tdb_error(ltdb->tdb)); - } - + tdb_transaction_cancel(ltdb->tdb); return LDB_SUCCESS; } |