]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/tdb1_transaction.c
tdb2: log an error when calling tdb_store() on read-only TDB in tdb1 backend.
[ccan] / ccan / tdb2 / tdb1_transaction.c
index fa6ffda379d2d706165c8c9a534168b5cdfbe56c..ecd7d2628e4981e42634da4617c6581f831a0d87 100644 (file)
@@ -1153,7 +1153,7 @@ int tdb1_transaction_commit(struct tdb_context *tdb)
        _tdb1_transaction_cancel(tdb);
 
        if (need_repack) {
-               return tdb1_repack(tdb);
+               return tdb_repack(tdb);
        }
 
        return 0;
@@ -1289,14 +1289,14 @@ int tdb1_transaction_recover(struct tdb_context *tdb)
 }
 
 /* Any I/O failures we say "needs recovery". */
-bool tdb1_needs_recovery(struct tdb_context *tdb)
+tdb_bool_err tdb1_needs_recovery(struct tdb_context *tdb)
 {
        tdb1_off_t recovery_head;
        struct tdb1_record rec;
 
        /* find the recovery area */
        if (tdb1_ofs_read(tdb, TDB1_RECOVERY_HEAD, &recovery_head) == -1) {
-               return true;
+               return tdb->last_error;
        }
 
        if (recovery_head == 0) {
@@ -1307,7 +1307,7 @@ bool tdb1_needs_recovery(struct tdb_context *tdb)
        /* read the recovery record */
        if (tdb->tdb1.io->tdb1_read(tdb, recovery_head, &rec,
                                   sizeof(rec), TDB1_DOCONV()) == -1) {
-               return true;
+               return tdb->last_error;
        }
 
        return (rec.magic == TDB1_RECOVERY_MAGIC);