]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:gencache: fix logic in stabilization when deleting a record from stable cache
authorMichael Adam <obnox@samba.org>
Thu, 26 Jun 2014 14:37:17 +0000 (16:37 +0200)
committerKarolin Seeger <kseeger@samba.org>
Sat, 24 Jan 2015 21:16:09 +0000 (22:16 +0100)
Set state->written = true in the delete case
if and only if the record has really been deleted.

This does currently not seem to lead to an unneeded
write to the DB, since failure to delete the record
will cause the traverse and hence the transaction
to cancel. But I think this is clearer.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
(cherry picked from commit 202ee81e869f4b51e1f904ef6ac3fb0030edfede)

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

source3/lib/gencache.c

index 2e9c496e37d0f7eec0ca5f8738f2e1afc0277441..9f87c1f3575ac6063b499c27a70e773130209d3a 100644 (file)
@@ -707,10 +707,10 @@ static int stabilize_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
        }
        if ((timeout < time(NULL)) || (val.dsize == 0)) {
                res = tdb_delete(cache, key);
-               if ((res != 0) && (tdb_error(cache) == TDB_ERR_NOEXIST)) {
-                       res = 0;
-               } else {
+               if (res == 0) {
                        state->written = true;
+               } else if (tdb_error(cache) == TDB_ERR_NOEXIST) {
+                       res = 0;
                }
        } else {
                res = tdb_store(cache, key, val, 0);