diff options
-rw-r--r-- | source4/lib/ldb/tools/ldbadd.c | 10 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbedit.c | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c index 086540dfdf..f022486db8 100644 --- a/source4/lib/ldb/tools/ldbadd.c +++ b/source4/lib/ldb/tools/ldbadd.c @@ -109,9 +109,13 @@ int main(int argc, const char **argv) } } - if (count != 0 && ldb_transaction_commit(ldb) != 0) { - printf("Failed to commit transaction: %s\n", ldb_errstring(ldb)); - exit(1); + if (count != 0) { + if (ldb_transaction_commit(ldb) != 0) { + printf("Failed to commit transaction: %s\n", ldb_errstring(ldb)); + exit(1); + } + } else { + ldb_transaction_cancel(ldb); } talloc_free(ldb); diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c index 9653eabcb9..ecadf0f61c 100644 --- a/source4/lib/ldb/tools/ldbedit.c +++ b/source4/lib/ldb/tools/ldbedit.c @@ -128,6 +128,7 @@ static int merge_edits(struct ldb_context *ldb, fprintf(stderr, "failed to add %s - %s\n", ldb_dn_get_linearized(msgs2[i]->dn), ldb_errstring(ldb)); + ldb_transaction_cancel(ldb); return -1; } adds++; @@ -149,6 +150,7 @@ static int merge_edits(struct ldb_context *ldb, fprintf(stderr, "failed to delete %s - %s\n", ldb_dn_get_linearized(msgs1[i]->dn), ldb_errstring(ldb)); + ldb_transaction_cancel(ldb); return -1; } deletes++; |