summaryrefslogtreecommitdiff
path: root/source3/lib/dbwrap
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-10-14 16:11:06 +0200
committerStefan Metzmacher <metze@samba.org>2011-10-14 20:59:37 +0200
commit15b8efeae3b0133ae60a8ce582e4ca4d4dbe6bb1 (patch)
tree41f932a209369eadb9790d601eae60160b4c7f46 /source3/lib/dbwrap
parentaf82bf2ac574b17cd2f7442f13928848d7d5a1e3 (diff)
downloadsamba-15b8efeae3b0133ae60a8ce582e4ca4d4dbe6bb1.tar.gz
samba-15b8efeae3b0133ae60a8ce582e4ca4d4dbe6bb1.tar.bz2
samba-15b8efeae3b0133ae60a8ce582e4ca4d4dbe6bb1.zip
s3:dbwrap_ctdb: return the number of records in db_ctdb_traverse() for persistent dbs
metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Fri Oct 14 20:59:37 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/lib/dbwrap')
-rw-r--r--source3/lib/dbwrap/dbwrap_ctdb.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index e0f98cc47d..38a339536e 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1297,12 +1297,21 @@ static int db_ctdb_traverse(struct db_context *db,
return ret;
}
if (ctx->transaction && ctx->transaction->m_write) {
- /* we now have to handle keys not yet present at transaction start */
+ /*
+ * we now have to handle keys not yet
+ * present at transaction start
+ */
struct db_context *newkeys = db_open_rbt(talloc_tos());
struct ctdb_marshall_buffer *mbuf = ctx->transaction->m_write;
struct ctdb_rec_data *rec=NULL;
NTSTATUS status;
int i;
+ int count = 0;
+
+ if (newkeys == NULL) {
+ return -1;
+ }
+
for (i=0; i<mbuf->count; i++) {
TDB_DATA key;
rec =db_ctdb_marshall_loop_next(mbuf, rec,
@@ -1317,9 +1326,12 @@ static int db_ctdb_traverse(struct db_context *db,
status = dbwrap_traverse(newkeys,
traverse_persistent_callback_dbwrap,
&state,
- NULL);
- ret = NT_STATUS_IS_OK(status) ? 0 : -1;
+ &count);
talloc_free(newkeys);
+ if (!NT_STATUS_IS_OK(status)) {
+ return -1;
+ }
+ ret += count;
}
return ret;
}