s3:lib/conn_tdb: implement connections_forall_read() based on smbXsrv_*_global_traverse()
[kai/samba.git] / source3 / lib / gencache.c
index d5ca164943d2b78381631c02ce461ceafe0830bc..95b4811acdfb04dc31fb3b97737eff4120128087 100644 (file)
@@ -344,11 +344,11 @@ bool gencache_parse(const char *keystr,
        state.private_data = private_data;
 
        ret = tdb_parse_record(cache_notrans, key, gencache_parse_fn, &state);
-       if (ret != -1) {
+       if (ret == 0) {
                return true;
        }
        ret = tdb_parse_record(cache, key, gencache_parse_fn, &state);
-       return (ret != -1);
+       return (ret == 0);
 }
 
 struct gencache_get_data_blob_state {
@@ -462,8 +462,8 @@ bool gencache_stabilize(void)
 
        res = tdb_transaction_start_nonblock(cache);
        if (res != 0) {
-
-               if (tdb_error(cache) == TDB_ERR_NOLOCK) {
+               if (tdb_error(cache) == TDB_ERR_NOLOCK)
+               {
                        /*
                         * Someone else already does the stabilize,
                         * this does not have to be done twice
@@ -472,7 +472,7 @@ bool gencache_stabilize(void)
                }
 
                DEBUG(10, ("Could not start transaction on gencache.tdb: "
-                          "%s\n", tdb_errorstr(cache)));
+                          "%s\n", tdb_errorstr_compat(cache)));
                return false;
        }
        res = tdb_transaction_start(cache_notrans);
@@ -480,7 +480,7 @@ bool gencache_stabilize(void)
                tdb_transaction_cancel(cache);
                DEBUG(10, ("Could not start transaction on "
                           "gencache_notrans.tdb: %s\n",
-                          tdb_errorstr(cache_notrans)));
+                          tdb_errorstr_compat(cache_notrans)));
                return false;
        }
 
@@ -503,7 +503,7 @@ bool gencache_stabilize(void)
        res = tdb_transaction_commit(cache);
        if (res != 0) {
                DEBUG(10, ("tdb_transaction_commit on gencache.tdb failed: "
-                          "%s\n", tdb_errorstr(cache)));
+                          "%s\n", tdb_errorstr_compat(cache)));
                tdb_transaction_cancel(cache_notrans);
                return false;
        }
@@ -511,7 +511,7 @@ bool gencache_stabilize(void)
        res = tdb_transaction_commit(cache_notrans);
        if (res != 0) {
                DEBUG(10, ("tdb_transaction_commit on gencache.tdb failed: "
-                          "%s\n", tdb_errorstr(cache)));
+                          "%s\n", tdb_errorstr_compat(cache)));
                return false;
        }
 
@@ -556,14 +556,14 @@ 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(cache)));
+                          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(cache_notrans)));
+                          "%s\n", tdb_errorstr_compat(cache_notrans)));
                state->error = true;
                return -1;
        }