mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
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 <obnox@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
This commit is contained in:
parent
202ee81e86
commit
d240cf7894
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user