ldb:ldbadd tool - use LDB result constants for consistency
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Fri, 14 Jan 2011 11:34:08 +0000 (12:34 +0100)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Wed, 9 Feb 2011 17:59:18 +0000 (18:59 +0100)
source4/lib/ldb/tools/ldbadd.c

index ab456f3d33c782ddd53d6177318ac514b1e6cd9f..6706c8af268bec8e39a5db1be3cbd0a693ade11b 100644 (file)
@@ -57,7 +57,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, unsigned int *count)
         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;
+               return LDB_ERR_OPERATIONS_ERROR;
        }
 
 
@@ -102,14 +102,14 @@ int main(int argc, const char **argv)
 {
        struct ldb_context *ldb;
        unsigned int i, count = 0;
-       int ret=0;
+       int ret = LDB_SUCCESS;
        TALLOC_CTX *mem_ctx = talloc_new(NULL);
 
        ldb = ldb_init(mem_ctx, NULL);
 
        options = ldb_cmdline_process(ldb, argc, argv, usage);
 
-       if (ldb_transaction_start(ldb) != 0) {
+       if (ldb_transaction_start(ldb) != LDB_SUCCESS) {
                printf("Failed to start transaction: %s\n", ldb_errstring(ldb));
                exit(1);
        }
@@ -131,7 +131,7 @@ int main(int argc, const char **argv)
        }
 
        if (count != 0) {
-               if (ldb_transaction_commit(ldb) != 0) {
+               if (ldb_transaction_commit(ldb) != LDB_SUCCESS) {
                        printf("Failed to commit transaction: %s\n", ldb_errstring(ldb));
                        exit(1);
                }