]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-mdb/add.c
Happy New Year
[openldap] / servers / slapd / back-mdb / add.c
index 0f5480d86bd859706da9e48ba612056eb92eccad..26bd264cc79c3e32e2bb9a1c9b23ecdd1d70f2f7 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2015 The OpenLDAP Foundation.
+ * Copyright 2000-2018 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@ mdb_add(Operation *op, SlapReply *rs )
        ID eid, pid = 0;
        mdb_op_info opinfo = {{{ 0 }}}, *moi = &opinfo;
        int subentry;
+       int numads = mdb->mi_numads;
 
        int             success;
 
@@ -368,6 +369,7 @@ mdb_add(Operation *op, SlapReply *rs )
                LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next );
                opinfo.moi_oe.oe_key = NULL;
                if ( op->o_noop ) {
+                       mdb->mi_numads = numads;
                        mdb_txn_abort( txn );
                        rs->sr_err = LDAP_X_NO_OPERATION;
                        txn = NULL;
@@ -377,6 +379,7 @@ mdb_add(Operation *op, SlapReply *rs )
                rs->sr_err = mdb_txn_commit( txn );
                txn = NULL;
                if ( rs->sr_err != 0 ) {
+                       mdb->mi_numads = numads;
                        rs->sr_text = "txn_commit failed";
                        Debug( LDAP_DEBUG_ANY,
                                LDAP_XSTRING(mdb_add) ": %s : %s (%d)\n",
@@ -400,6 +403,7 @@ return_results:
 
        if( moi == &opinfo ) {
                if( txn != NULL ) {
+                       mdb->mi_numads = numads;
                        mdb_txn_abort( txn );
                }
                if ( opinfo.moi_oe.oe_key ) {