summaryrefslogtreecommitdiff
path: root/source3/lib/tdb_validate.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/tdb_validate.c')
-rw-r--r--source3/lib/tdb_validate.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source3/lib/tdb_validate.c b/source3/lib/tdb_validate.c
index b91ea7af83..385f4d0ef8 100644
--- a/source3/lib/tdb_validate.c
+++ b/source3/lib/tdb_validate.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "system/filesys.h"
+#include "util_tdb.h"
#include "tdb_validate.h"
/*
@@ -50,12 +51,13 @@ static int tdb_validate_child(struct tdb_context *tdb,
* but I don't want to change all the callers...
*/
ret = tdb_check(tdb, NULL, NULL);
- if (ret == -1) {
+ if (ret != 0) {
v_status.tdb_error = True;
v_status.success = False;
goto out;
}
+#ifndef BUILD_TDB2
/* Check if the tdb's freelist is good. */
if (tdb_validate_freelist(tdb, &num_entries) == -1) {
v_status.bad_freelist = True;
@@ -65,12 +67,13 @@ static int tdb_validate_child(struct tdb_context *tdb,
DEBUG(10,("tdb_validate_child: tdb %s freelist has %d entries\n",
tdb_name(tdb), num_entries));
+#endif
/* Now traverse the tdb to validate it. */
num_entries = tdb_traverse(tdb, validate_fn, (void *)&v_status);
if (!v_status.success) {
goto out;
- } else if (num_entries == -1) {
+ } else if (num_entries < 0) {
v_status.tdb_error = True;
v_status.success = False;
goto out;
@@ -288,8 +291,14 @@ static int tdb_backup(TALLOC_CTX *ctx, const char *src_path,
}
unlink(tmp_path);
- dst_tdb = tdb_open_log(tmp_path,
- hash_size ? hash_size : tdb_hash_size(src_tdb),
+
+#ifndef BUILD_TDB2
+ if (!hash_size) {
+ hash_size = tdb_hash_size(src_tdb);
+ }
+#endif
+
+ dst_tdb = tdb_open_log(tmp_path, hash_size,
TDB_DEFAULT, O_RDWR | O_CREAT | O_EXCL,
st.st_mode & 0777);
if (dst_tdb == NULL) {