diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-02-01 20:34:44 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-02-09 18:59:19 +0100 |
commit | 8d80225afb764e937e41e0d52586e1f038871734 (patch) | |
tree | c0b5baaec572fe09490f9b04bb5ce011d6f8475d /source4/lib/ldb/tools/ldbmodify.c | |
parent | 5e06b21cc1553606efaeae03504e91d811793085 (diff) | |
download | samba-8d80225afb764e937e41e0d52586e1f038871734.tar.gz samba-8d80225afb764e937e41e0d52586e1f038871734.tar.bz2 samba-8d80225afb764e937e41e0d52586e1f038871734.zip |
ldb:tools - return LDB_ERR_OPERATIONS_ERROR on generic errors
Use "return" when located in "main" for consistency ("exit" would do the
same).
The patchset has been discussed with Jelmer Vernooij and afterwards LDB
maintainer Simo Sorce.
Diffstat (limited to 'source4/lib/ldb/tools/ldbmodify.c')
-rw-r--r-- | source4/lib/ldb/tools/ldbmodify.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c index 8d5e04b81c..1484bbf655 100644 --- a/source4/lib/ldb/tools/ldbmodify.c +++ b/source4/lib/ldb/tools/ldbmodify.c @@ -43,7 +43,7 @@ static void usage(struct ldb_context *ldb) printf("Usage: ldbmodify <options> <ldif...>\n"); printf("Modifies a ldb based upon ldif change records\n\n"); ldb_cmdline_help(ldb, "ldbmodify", stdout); - exit(1); + exit(LDB_ERR_OPERATIONS_ERROR); } /* @@ -54,9 +54,10 @@ static int process_file(struct ldb_context *ldb, FILE *f, unsigned int *count) struct ldb_ldif *ldif; int ret = LDB_SUCCESS; struct ldb_control **req_ctrls = ldb_parse_control_strings(ldb, ldb, (const char **)options->controls); + if (options->controls != NULL && req_ctrls== NULL) { printf("parsing controls failed: %s\n", ldb_errstring(ldb)); - return -1; + exit(LDB_ERR_OPERATIONS_ERROR); } while ((ldif = ldb_ldif_read_file(ldb, f))) { @@ -112,7 +113,7 @@ int main(int argc, const char **argv) f = fopen(fname, "r"); if (!f) { perror(fname); - exit(1); + return LDB_ERR_OPERATIONS_ERROR; } ret = process_file(ldb, f, &count); fclose(f); |