summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/ldb/tools/ldbmodify.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c
index 8fa0dcf0b6..901a4c9628 100644
--- a/source4/lib/ldb/tools/ldbmodify.c
+++ b/source4/lib/ldb/tools/ldbmodify.c
@@ -101,25 +101,17 @@ static int process_file(struct ldb_context *ldb, FILE *f)
options = ldb_cmdline_process(ldb, argc, argv, usage);
if (options->argc == 0) {
- usage();
- exit(1);
- }
-
- for (i=0;i<options->argc;i++) {
- const char *fname = options->argv[i];
- FILE *f;
- if (strcmp(fname,"-") == 0) {
- f = stdin;
- } else {
+ count += process_file(ldb, stdin);
+ } else {
+ for (i=0;i<options->argc;i++) {
+ const char *fname = options->argv[i];
+ FILE *f;
f = fopen(fname, "r");
- }
- if (!f) {
- perror(fname);
- exit(1);
- }
- count += process_file(ldb, f);
- if (f != stdin) {
- fclose(f);
+ if (!f) {
+ perror(fname);
+ exit(1);
+ }
+ count += process_file(ldb, f);
}
}