From 997592431f3e62cacef13d9b75a12a3d8058e7b7 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 14 Sep 2011 07:42:13 +0930 Subject: tdb2: use tdb->flags & TDB_RDONLY instead of tdb->read_only for TDB1 code. There's also a semantic change here: for tdb1, being read-only meant no locking, and it was an error to try to lock a r/o database. For TDB2, you'd need to specify TDB_NOLOCK, which suppresses locking silently. Signed-off-by: Rusty Russell (Imported from CCAN commit 4dc29a338fadeac805b369b4b0851c02f1b152c7) --- lib/tdb2/tdb1_check.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/tdb2/tdb1_check.c') diff --git a/lib/tdb2/tdb1_check.c b/lib/tdb2/tdb1_check.c index edbfd86bcf..9097017ea1 100644 --- a/lib/tdb2/tdb1_check.c +++ b/lib/tdb2/tdb1_check.c @@ -334,9 +334,8 @@ int tdb1_check(struct tdb1_context *tdb, tdb1_len_t dead; bool locked; - /* Read-only databases use no locking at all: it's best-effort. - * We may have a write lock already, so skip that case too. */ - if (tdb->read_only || tdb->file->allrecord_lock.count != 0) { + /* We may have a write lock already, so don't re-lock. */ + if (tdb->file->allrecord_lock.count != 0) { locked = false; } else { if (tdb1_lockall_read(tdb) == -1) -- cgit