diff options
author | Jeremy Allison <jra@samba.org> | 2010-07-28 05:15:40 -0700 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-07-29 08:56:35 +0930 |
commit | bc1c82ea137e1bf6cb55139a666c56ebb2226b23 (patch) | |
tree | 3ad9b5c8b2b69302ef01cd2d80d4acf325563f6e /lib/tdb | |
parent | 39d287ec67d9c33b17c8809ac34d3c09f72f689d (diff) | |
download | samba-bc1c82ea137e1bf6cb55139a666c56ebb2226b23.tar.gz samba-bc1c82ea137e1bf6cb55139a666c56ebb2226b23.tar.bz2 samba-bc1c82ea137e1bf6cb55139a666c56ebb2226b23.zip |
Fix tdb_check() to work with read-only tdb databases. The function tdb_lockall() uses F_WRLCK internally, which doesn't work on a fd opened with O_RDONLY. Use tdb_lockall_read() instead.
Jeremy.
Diffstat (limited to 'lib/tdb')
-rw-r--r-- | lib/tdb/common/check.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/tdb/common/check.c b/lib/tdb/common/check.c index 6bbfd7d82a..2c640434ee 100644 --- a/lib/tdb/common/check.c +++ b/lib/tdb/common/check.c @@ -311,7 +311,7 @@ int tdb_check(struct tdb_context *tdb, struct tdb_record rec; bool found_recovery = false; - if (tdb_lockall(tdb) == -1) + if (tdb_lockall_read(tdb) == -1) return -1; /* Make sure we know true size of the underlying file. */ @@ -412,12 +412,12 @@ int tdb_check(struct tdb_context *tdb, } free(hashes); - tdb_unlockall(tdb); + tdb_unlockall_read(tdb); return 0; free: free(hashes); unlock: - tdb_unlockall(tdb); + tdb_unlockall_read(tdb); return -1; } |