summaryrefslogtreecommitdiff
path: root/lib/tdb2/transaction.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:09:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:09:13 +0930
commit34c2d1658a89462e9b34210cb19fe9ab33bc2194 (patch)
treeb9623d98da69e9987daa37e1fe2cfbc10efd16a2 /lib/tdb2/transaction.c
parent1bba793fd64f635b8055a34973cded1f67e958e4 (diff)
downloadsamba-34c2d1658a89462e9b34210cb19fe9ab33bc2194.tar.gz
samba-34c2d1658a89462e9b34210cb19fe9ab33bc2194.tar.bz2
samba-34c2d1658a89462e9b34210cb19fe9ab33bc2194.zip
tdb2: cleanup oob handling.
The tdb_oob() function can fail due to errors, as well as because the length asked for is greater than the size of the file. Clean that up: (1) If probe is true, only fail if there's an error, not if the length is too great. (2) Exit tdb_open() if it tdb_oob() probe fails; this helps cut down test time for failtest. (3) Don't set probe to true in tdb_direct() fail; a minor issue, but it means we log failure. (Imported from CCAN commit 77658070a3e4f712b94d659b2e399031ce3394c8) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/tdb2/transaction.c')
-rw-r--r--lib/tdb2/transaction.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/tdb2/transaction.c b/lib/tdb2/transaction.c
index b13223bc2e..eda65c5208 100644
--- a/lib/tdb2/transaction.c
+++ b/lib/tdb2/transaction.c
@@ -348,15 +348,14 @@ static void transaction_write_existing(struct tdb_context *tdb, tdb_off_t off,
static enum TDB_ERROR transaction_oob(struct tdb_context *tdb, tdb_off_t len,
bool probe)
{
- if (len <= tdb->file->map_size) {
+ if (len <= tdb->file->map_size || probe) {
return TDB_SUCCESS;
}
- if (!probe) {
- tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_ERROR,
- "tdb_oob len %lld beyond transaction size %lld",
- (long long)len,
- (long long)tdb->file->map_size);
- }
+
+ tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_ERROR,
+ "tdb_oob len %lld beyond transaction size %lld",
+ (long long)len,
+ (long long)tdb->file->map_size);
return TDB_ERR_IO;
}