summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-19 04:20:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:29 -0500
commite485e80b512f17aba0b6b1dd5acc3f738f4189c1 (patch)
tree32ea9a2740a8dc8b8fbcebc393eef011c7bff231 /source4
parent225d5a334fca1a52714f0120d0961236db0f236c (diff)
downloadsamba-e485e80b512f17aba0b6b1dd5acc3f738f4189c1.tar.gz
samba-e485e80b512f17aba0b6b1dd5acc3f738f4189c1.tar.bz2
samba-e485e80b512f17aba0b6b1dd5acc3f738f4189c1.zip
r7743: be consistent in how stdin is supported for ldbadd and ldbmodify
(This used to be commit 3d60b3a8eea5ac6c35cf2e579ae12cef3dc1794e)
Diffstat (limited to 'source4')
-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);
}
}