]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Remove two pointless globals
authorVolker Lendecke <vl@samba.org>
Thu, 1 Jan 2009 17:16:42 +0000 (18:16 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 1 Jan 2009 18:08:33 +0000 (19:08 +0100)
source3/lib/ldb/tools/ldbadd.c
source3/lib/ldb/tools/ldbmodify.c

index 4dde2a1ef537c9567c0e40cb7af029252893c182..155395e065ae957576a0d9cf070d71ac6cc60abe 100644 (file)
@@ -35,8 +35,6 @@
 #include "ldb/include/includes.h"
 #include "ldb/tools/cmdline.h"
 
-static int failures;
-
 static void usage(void)
 {
        printf("Usage: ldbadd <options> <ldif...>\n");
@@ -53,7 +51,8 @@ static void usage(void)
 /*
   add records from an opened file
 */
-static int process_file(struct ldb_context *ldb, FILE *f, int *count)
+static int process_file(struct ldb_context *ldb, FILE *f, int *count,
+                       int *failures)
 {
        struct ldb_ldif *ldif;
        int ret = LDB_SUCCESS;
@@ -71,7 +70,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count)
                if (ret != LDB_SUCCESS) {
                        fprintf(stderr, "ERR: \"%s\" on DN %s\n", 
                                ldb_errstring(ldb), ldb_dn_linearize(ldb, ldif->msg->dn));
-                       failures++;
+                       (*failures)++;
                } else {
                        (*count)++;
                }
@@ -86,7 +85,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count)
 int main(int argc, const char **argv)
 {
        struct ldb_context *ldb;
-       int i, ret=0, count=0;
+       int i, ret=0, count=0, failures=0;
        struct ldb_cmdline *options;
 
        ldb_global_init();
@@ -96,7 +95,7 @@ int main(int argc, const char **argv)
        options = ldb_cmdline_process(ldb, argc, argv, usage);
 
        if (options->argc == 0) {
-               ret = process_file(ldb, stdin, &count);
+               ret = process_file(ldb, stdin, &count, &failures);
        } else {
                for (i=0;i<options->argc;i++) {
                        const char *fname = options->argv[i];
@@ -106,7 +105,7 @@ int main(int argc, const char **argv)
                                perror(fname);
                                exit(1);
                        }
-                       ret = process_file(ldb, f, &count);
+                       ret = process_file(ldb, f, &count, &failures);
                        fclose(f);
                }
        }
index 368b4cf996f2ed7c726fb88ab08ce5ba04120127..f12387a8f645216ff06258b767e6db0fbc5ed997 100644 (file)
@@ -35,8 +35,6 @@
 #include "ldb/include/includes.h"
 #include "ldb/tools/cmdline.h"
 
-static int failures;
-
 static void usage(void)
 {
        printf("Usage: ldbmodify <options> <ldif...>\n");
@@ -52,7 +50,8 @@ static void usage(void)
 /*
   process modifies for one file
 */
-static int process_file(struct ldb_context *ldb, FILE *f, int *count)
+static int process_file(struct ldb_context *ldb, FILE *f, int *count,
+                       int *failures)
 {
        struct ldb_ldif *ldif;
        int ret = LDB_SUCCESS;
@@ -73,7 +72,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count)
                if (ret != LDB_SUCCESS) {
                        fprintf(stderr, "ERR: \"%s\" on DN %s\n", 
                                ldb_errstring(ldb), ldb_dn_linearize(ldb, ldif->msg->dn));
-                       failures++;
+                       (*failures)++;
                } else {
                        (*count)++;
                }
@@ -87,6 +86,7 @@ int main(int argc, const char **argv)
 {
        struct ldb_context *ldb;
        int count=0;
+       int failures=0;
        int i, ret=LDB_SUCCESS;
        struct ldb_cmdline *options;
 
@@ -97,7 +97,7 @@ int main(int argc, const char **argv)
        options = ldb_cmdline_process(ldb, argc, argv, usage);
 
        if (options->argc == 0) {
-               ret = process_file(ldb, stdin, &count);
+               ret = process_file(ldb, stdin, &count, &failures);
        } else {
                for (i=0;i<options->argc;i++) {
                        const char *fname = options->argv[i];
@@ -107,7 +107,7 @@ int main(int argc, const char **argv)
                                perror(fname);
                                exit(1);
                        }
-                       ret = process_file(ldb, f, &count);
+                       ret = process_file(ldb, f, &count, &failures);
                }
        }