summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2014-06-26 16:37:17 +0200
committerVolker Lendecke <vl@samba.org>2014-11-26 16:43:04 +0100
commit202ee81e869f4b51e1f904ef6ac3fb0030edfede (patch)
tree4a00a578cd25a79138cdabca1a2373dda4a4fa99
parent42b2e5ca8c9b85e6fce71529bef5d6b3ba4f4a38 (diff)
downloadsamba-202ee81e869f4b51e1f904ef6ac3fb0030edfede.tar.gz
s3:gencache: fix logic in stabilization when deleting a record from stable cache
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>
-rw-r--r--source3/lib/gencache.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index 5ee406b9050..c7646e3d14e 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -718,10 +718,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);