summaryrefslogtreecommitdiff
path: root/lib/tdb2/open.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/open.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/open.c')
-rw-r--r--lib/tdb2/open.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/tdb2/open.c b/lib/tdb2/open.c
index 43a9a2b40e..fb0e05fcaa 100644
--- a/lib/tdb2/open.c
+++ b/lib/tdb2/open.c
@@ -561,7 +561,9 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
tdb_unlock_open(tdb, openlock);
/* This make sure we have current map_size and mmap. */
- tdb->methods->oob(tdb, tdb->file->map_size + 1, true);
+ ecode = tdb->methods->oob(tdb, tdb->file->map_size + 1, true);
+ if (unlikely(ecode != TDB_SUCCESS))
+ goto fail;
/* Now it's fully formed, recover if necessary. */
berr = tdb_needs_recovery(tdb);