From d240cf7894f076a2ed2b6bc434f20a93cfbb1ca4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 26 Jun 2014 16:56:41 +0200 Subject: [PATCH] s3:gencache: simply stabilize() a bit more: remove error from state state.error is set to true if and only if the traverse callback returns error (-1), and hence only if the traverse fails. Hence the the error state is redundant. Signed-off-by: Michael Adam Reviewed-by: Christof Schmitt --- source3/lib/gencache.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index c7646e3d14e..3d165cda3c0 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -614,7 +614,6 @@ fail: struct stabilize_state { bool written; - bool error; }; static int stabilize_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val, void *priv); @@ -660,11 +659,10 @@ bool gencache_stabilize(void) return false; } - state.error = false; state.written = false; res = tdb_traverse(cache_notrans, stabilize_fn, &state); - if ((res < 0) || state.error) { + if (res < 0) { tdb_transaction_cancel(cache_notrans); tdb_transaction_cancel(cache); return false; @@ -733,14 +731,12 @@ static int stabilize_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val, if (res != 0) { DEBUG(10, ("Transfer to gencache.tdb failed: %s\n", tdb_errorstr_compat(cache))); - state->error = true; return -1; } if (tdb_delete(cache_notrans, key) != 0) { DEBUG(10, ("tdb_delete from gencache_notrans.tdb failed: " "%s\n", tdb_errorstr_compat(cache_notrans))); - state->error = true; return -1; } return 0;