r11109: fixed the error code return from most ldb functions (the change to use
authorAndrew Tridgell <tridge@samba.org>
Mon, 17 Oct 2005 11:26:23 +0000 (11:26 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:44:51 +0000 (13:44 -0500)
ldb_transaction_cancel() broke it)
(This used to be commit dc41994ea72c7c7f571efa009930cf36d7a9897a)

source4/lib/ldb/common/ldb.c

index d34ddb4c8ade0a32e283997e4d455574809e2063..abd2c03aa3aa05786127ed7dd8c0e15071f13804 100644 (file)
@@ -168,8 +168,6 @@ int ldb_transaction_cancel(struct ldb_context *ldb)
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       ldb_reset_err_string(ldb);
-
        return module->ops->del_transaction(module);
 }
 
@@ -246,7 +244,10 @@ int ldb_add(struct ldb_context *ldb,
                if (status != LDB_SUCCESS) return status;
 
                status = module->ops->add_record(module, message);
-               if (status != LDB_SUCCESS) return ldb_transaction_cancel(ldb);
+               if (status != LDB_SUCCESS) {
+                       ldb_transaction_cancel(ldb);
+                       return status;
+               }
                return ldb_transaction_commit(ldb);
        }
 
@@ -274,7 +275,10 @@ int ldb_modify(struct ldb_context *ldb,
                if (status != LDB_SUCCESS) return status;
 
                status = module->ops->modify_record(module, message);
-               if (status != LDB_SUCCESS) return ldb_transaction_cancel(ldb);
+               if (status != LDB_SUCCESS) {
+                       ldb_transaction_cancel(ldb);
+                       return status;
+               }
                return ldb_transaction_commit(ldb);
        }
 
@@ -299,7 +303,10 @@ int ldb_delete(struct ldb_context *ldb, const struct ldb_dn *dn)
                if (status != LDB_SUCCESS) return status;
 
                status = module->ops->delete_record(module, dn);
-               if (status != LDB_SUCCESS) return ldb_transaction_cancel(ldb);
+               if (status != LDB_SUCCESS) {
+                       ldb_transaction_cancel(ldb);
+                       return status;
+               }
                return ldb_transaction_commit(ldb);
        }
 
@@ -323,7 +330,10 @@ int ldb_rename(struct ldb_context *ldb, const struct ldb_dn *olddn, const struct
                if (status != LDB_SUCCESS) return status;
 
                status = module->ops->rename_record(module, olddn, newdn);
-               if (status != LDB_SUCCESS) return ldb_transaction_cancel(ldb);
+               if (status != LDB_SUCCESS) {
+                       ldb_transaction_cancel(ldb);
+                       return status;
+               }
                return ldb_transaction_commit(ldb);
        }