"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).
{
unsigned int i;
struct ldb_message *msg;
{
unsigned int i;
struct ldb_message *msg;
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) {
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) {
- 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;
printf("# %u adds %u modifies %u deletes\n", adds, modifies, deletes);
printf("# %u adds %u modifies %u deletes\n", adds, modifies, deletes);