summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-02-05 13:19:56 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2011-02-09 18:59:19 +0100
commit475ea1ca595b3f6ea5fd6476c28f21995d781529 (patch)
tree97e94e33641f4e4d5d687bffdda66fd5b957e346
parent79d3532f7f905afe1a48acabf75247cef6f791e3 (diff)
downloadsamba-475ea1ca595b3f6ea5fd6476c28f21995d781529.tar.gz
samba-475ea1ca595b3f6ea5fd6476c28f21995d781529.tar.bz2
samba-475ea1ca595b3f6ea5fd6476c28f21995d781529.zip
ldb:ldbedit tool - don't forget about the "do_edit" result code
Use it for computing the program exit code. The "result" has not to be free'd explicitly since it's a child by "ldb" which itself is child by "mem_ctx".
-rw-r--r--source4/lib/ldb/tools/ldbedit.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index ecdb4d7f62..09c59cf6cd 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -343,20 +343,13 @@ int main(int argc, const char **argv)
if (result->count == 0) {
printf("no matching records - cannot edit\n");
- return 0;
+ talloc_free(mem_ctx);
+ return LDB_SUCCESS;
}
- do_edit(ldb, result->msgs, result->count, options->editor);
-
- if (result) {
- ret = talloc_free(result);
- if (ret == -1) {
- fprintf(stderr, "talloc_free failed\n");
- exit(1);
- }
- }
+ ret = do_edit(ldb, result->msgs, result->count, options->editor);
talloc_free(mem_ctx);
- return 0;
+ return ret == 0 ? LDB_SUCCESS : LDB_ERR_OPERATIONS_ERROR;
}