r19688: Fix a deadcode warning by Coverity.
authorVolker Lendecke <vlendec@samba.org>
Mon, 13 Nov 2006 10:43:12 +0000 (10:43 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:15:47 +0000 (12:15 -0500)
Simo, I'm not sure this is the correct fix. So I'd like you to look at it and
merge to 4 if appropriate.

Volker
(This used to be commit afd7f12124b02b594063535f93903a8a598a0587)

source3/lib/ldb/modules/schema.c

index 556a35060d05364e579f09196aed3a96f9870e4a..221263a8695daddbf307566cf73f464cb526d6ee 100644 (file)
@@ -201,12 +201,7 @@ static int get_attr_list_recursive(struct ldb_module *module, struct schema_stru
                }
 
                ret = ldb_search(module->ldb, NULL, LDB_SCOPE_SUBTREE, filter, NULL, &srch);
-               if (ret != 1) {
-                       return ret;
-               }
-               talloc_steal(schema_struct, srch);
-
-               if (ret <= 0) {
+               if (ret != LDB_SUCCESS) {
                        /* Schema DB Error: Error occurred retrieving
                           Object Class Description */
                        ldb_debug_set(module->ldb, LDB_DEBUG_ERROR, 
@@ -214,7 +209,10 @@ static int get_attr_list_recursive(struct ldb_module *module, struct schema_stru
                                      schema_struct->objectclasses.attr[i].name);
                        return -1;
                }
-               if (ret > 1) {
+
+               talloc_steal(schema_struct, srch);
+
+               if (srch->count > 1) {
                        /* Schema DB Error: Too Many Records */
                        ldb_debug_set(module->ldb, LDB_DEBUG_ERROR, 
                                      "Too many records found retrieving Objectclass %s.\n",