tdb2: add TDB_RDONLY flag, allow setting/unsetting it.
[ccan] / ccan / tdb2 / transaction.c
index 2f588ef37ad1d8dcb8aed53a0adfdf0bf116d6f4..a29acf96e2d417c8c3d79313f8ada959f7c5719c 100644 (file)
@@ -532,7 +532,7 @@ enum TDB_ERROR tdb_transaction_start(struct tdb_context *tdb)
                                                    " internal tdb");
        }
 
-       if (tdb->read_only) {
+       if (tdb->flags & TDB_RDONLY) {
                return tdb->last_error = tdb_logerr(tdb, TDB_ERR_RDONLY,
                                                    TDB_LOG_USE_ERROR,
                                                    "tdb_transaction_start:"
@@ -1196,7 +1196,7 @@ enum TDB_ERROR tdb_transaction_recover(struct tdb_context *tdb)
                return TDB_SUCCESS;
        }
 
-       if (tdb->read_only) {
+       if (tdb->flags & TDB_RDONLY) {
                return tdb_logerr(tdb, TDB_ERR_CORRUPT, TDB_LOG_ERROR,
                                  "tdb_transaction_recover:"
                                  " attempt to recover read only database");