s3:gencache: fix logic in stabilization when deleting a record from stable cache
[obnox/samba/samba-obnox.git] / source3 / lib / gencache.c
index 5ee406b9050e3553818b5dce35170f055e2a0c34..c7646e3d14e74b095890ae7df7b4b10d55618fa7 100644 (file)
@@ -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);