diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:16:13 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:16:13 +0930 |
commit | bdc5499205367eccef5700cba8af95ba941ac9b2 (patch) | |
tree | 1e6da444d90d469c8cd600c0006c7477150b5aa8 /lib/tdb2/transaction.c | |
parent | 37c704be0af3b5915e6630264dc4379309d83160 (diff) | |
download | samba-bdc5499205367eccef5700cba8af95ba941ac9b2.tar.gz samba-bdc5499205367eccef5700cba8af95ba941ac9b2.tar.xz samba-bdc5499205367eccef5700cba8af95ba941ac9b2.zip |
tdb2: add TDB_RDONLY flag, allow setting/unsetting it.
You can only unset it if the TDB was originally opened O_RDWR.
Also, cleaned up error handling in tdb_allrecord_lock() so we only get
one log message on a r/o database.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit b87e14495d5b07e1b247218a72329f10ecb3da7f)
Diffstat (limited to 'lib/tdb2/transaction.c')
-rw-r--r-- | lib/tdb2/transaction.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/tdb2/transaction.c b/lib/tdb2/transaction.c index 2f588ef37ad..a29acf96e2d 100644 --- a/lib/tdb2/transaction.c +++ b/lib/tdb2/transaction.c @@ -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"); |