summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-01-14 12:48:54 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2011-02-09 18:59:19 +0100
commit79d3532f7f905afe1a48acabf75247cef6f791e3 (patch)
tree3bf8b5bf87378a8563bb89670934d0a1158e1ef8 /source4/lib
parentb5ccf181f55192ac199af5e377254057a876a216 (diff)
downloadsamba-79d3532f7f905afe1a48acabf75247cef6f791e3.tar.gz
samba-79d3532f7f905afe1a48acabf75247cef6f791e3.tar.bz2
samba-79d3532f7f905afe1a48acabf75247cef6f791e3.zip
ldb:ldbedit tool - fix bug #7914
"modify_record" returns "-1" when failing, otherwise the number of modifies performed as an "unsigned int" converted to "int". When we get "-1" we immediately need to stop (the error message has already been generated by the function itself).
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/tools/ldbedit.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index 5b8beb662d..ecdb4d7f62 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -119,7 +119,7 @@ static int merge_edits(struct ldb_context *ldb,
{
unsigned int i;
struct ldb_message *msg;
- int ret = 0;
+ int ret;
unsigned int adds=0, modifies=0, deletes=0;
struct ldb_control **req_ctrls = ldb_parse_control_strings(ldb, ldb, (const char **)options->controls);
if (options->controls != NULL && req_ctrls == NULL) {
@@ -148,8 +148,11 @@ static int merge_edits(struct ldb_context *ldb,
}
adds++;
} else {
- if (modify_record(ldb, msg, msgs2[i], req_ctrls) > 0) {
- modifies++;
+ ret = modify_record(ldb, msg, msgs2[i], req_ctrls);
+ if (ret != -1) {
+ modifies += (unsigned int) ret;
+ } else {
+ return -1;
}
}
}
@@ -179,7 +182,7 @@ static int merge_edits(struct ldb_context *ldb,
printf("# %u adds %u modifies %u deletes\n", adds, modifies, deletes);
- return ret;
+ return 0;
}
/*