]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:gencache: simply stabilize() a bit more: remove error from state
authorMichael Adam <obnox@samba.org>
Thu, 26 Jun 2014 14:56:41 +0000 (16:56 +0200)
committerKarolin Seeger <kseeger@samba.org>
Sat, 24 Jan 2015 21:16:09 +0000 (22:16 +0100)
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 <obnox@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
(cherry picked from commit d240cf7894f076a2ed2b6bc434f20a93cfbb1ca4)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11032

source3/lib/gencache.c

index 9f87c1f3575ac6063b499c27a70e773130209d3a..ed2b0be21dcbb788bae27010b6d9ad3cb5368907 100644 (file)
@@ -603,7 +603,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);
@@ -649,11 +648,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;
@@ -722,14 +720,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;