s4-ldb: fixed tdb error handling in ldb_index.c
authorAndrew Tridgell <tridge@samba.org>
Thu, 22 Oct 2009 00:15:18 +0000 (11:15 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 22 Oct 2009 01:47:55 +0000 (12:47 +1100)
source4/lib/ldb/ldb_tdb/ldb_index.c

index 8578e06c0de368e327ef56155f445af290514503..501907578d91c9674ce1f07d304633d80797e15f 100644 (file)
@@ -287,8 +287,10 @@ static int ltdb_dn_list_store(struct ldb_module *module, struct ldb_dn *dn,
        rec.dsize = sizeof(void *);
 
        ret = tdb_store(ltdb->idxptr->itdb, key, rec, TDB_INSERT);
-
-       return ret;     
+       if (ret == -1) {
+               return ltdb_err_map(tdb_error(ltdb->idxptr->itdb));
+       }
+       return LDB_SUCCESS;
 }
 
 /*
@@ -320,7 +322,10 @@ static int ltdb_index_traverse_store(struct tdb_context *tdb, TDB_DATA key, TDB_
 
        ltdb->idxptr->error = ltdb_dn_list_store_full(module, dn, list);
        talloc_free(dn);
-       return ltdb->idxptr->error;
+       if (ltdb->idxptr->error != 0) {
+               return -1;
+       }
+       return 0;
 }
 
 /* cleanup the idxptr mode when transaction commits */