These warnings were spotted by Sumit initially. I just ran into them
again while compiling on a machine with stricter CFLAGS.
>From a6846bb687b243f738654ce7d4d72710f690ba6d Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <[email protected]>
Date: Sun, 16 Dec 2012 17:10:32 +0100
Subject: [PATCH] MEMBEROF: silence compilation warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

src/ldb_modules/memberof.c: In function ‘mbof_get_ghost_from_parent_cb’:
src/ldb_modules/memberof.c:3085: warning: declaration of ‘dup’ shadows a global 
declaration
/usr/include/unistd.h:528: warning: shadowed declaration is here
src/ldb_modules/memberof.c: In function ‘mbof_inherited_mod’:
src/ldb_modules/memberof.c:3253: warning: declaration of ‘dup’ shadows a global 
declaration
/usr/include/unistd.h:528: warning: shadowed declaration is here
src/ldb_modules/memberof.c: In function ‘mbof_fill_vals_array’:
src/ldb_modules/memberof.c:3786: warning: declaration of ‘index’ shadows a 
global declaration
/usr/include/string.h:489: warning: shadowed declaration is here
---
 src/ldb_modules/memberof.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c
index 
9f67d8656db2459ecfe5626824223885fbcd0909..0f947fb06694e80d1fccf6392fbe3c87821adbeb
 100644
--- a/src/ldb_modules/memberof.c
+++ b/src/ldb_modules/memberof.c
@@ -3078,7 +3078,7 @@ static int mbof_get_ghost_from_parent_cb(struct 
ldb_request *req,
     struct mbof_mod_del_op *igh;
     struct mbof_ctx *ctx;
     struct ldb_message_element *el;
-    struct ldb_val *dup;
+    struct ldb_val *dupval;
     int ret;
     hash_value_t value;
     hash_key_t key;
@@ -3114,18 +3114,18 @@ static int mbof_get_ghost_from_parent_cb(struct 
ldb_request *req,
                 continue;
             }
 
-            dup = talloc_zero(igh->inherited_gh, struct ldb_val);
-            if (dup == NULL) {
+            dupval = talloc_zero(igh->inherited_gh, struct ldb_val);
+            if (dupval == NULL) {
                 return LDB_ERR_OPERATIONS_ERROR;
             }
 
-            *dup = ldb_val_dup(igh->inherited_gh, &el->values[i]);
-            if (dup->data == NULL) {
+            *dupval = ldb_val_dup(igh->inherited_gh, &el->values[i]);
+            if (dupval->data == NULL) {
                 return LDB_ERR_OPERATIONS_ERROR;
             }
 
             value.type = HASH_VALUE_PTR;
-            value.ptr = dup;
+            value.ptr = dupval;
 
             ret = hash_enter(igh->inherited_gh, &key, &value);
             if (ret != HASH_SUCCESS) {
@@ -3246,7 +3246,7 @@ static int mbof_inherited_mod(struct mbof_mod_ctx 
*mod_ctx)
     struct ldb_message_element *el;
     struct ldb_message *msg;
     struct ldb_val *val;
-    struct ldb_val *dup;
+    struct ldb_val *dupval;
     hash_value_t *values;
     unsigned long num_values;
     int i, j;
@@ -3281,8 +3281,8 @@ static int mbof_inherited_mod(struct mbof_mod_ctx 
*mod_ctx)
     for (i = 0, j = 0; i < num_values; i++) {
         val = talloc_get_type(values[i].ptr, struct ldb_val);
 
-        dup = ldb_msg_find_val(mod_ctx->ghel, val);
-        if (dup) {
+        dupval = ldb_msg_find_val(mod_ctx->ghel, val);
+        if (dupval) {
             continue;
         }
 
@@ -3779,7 +3779,7 @@ static int mbof_fill_vals_array(TALLOC_CTX *memctx,
                                 struct mbof_val_array **val_array)
 {
     struct mbof_val_array *var = *val_array;
-    int i, index;
+    int i, vi;
 
     if (var == NULL) {
         var = talloc_zero(memctx, struct mbof_val_array);
@@ -3795,7 +3795,7 @@ static int mbof_fill_vals_array(TALLOC_CTX *memctx,
 
     /* We do not care about duplicate values now.
      * They will be filtered later */
-    index = var->num;
+    vi = var->num;
     var->num += num_values;
     var->vals = talloc_realloc(memctx, var->vals, struct ldb_val, var->num);
     if (!var->vals) {
@@ -3804,13 +3804,13 @@ static int mbof_fill_vals_array(TALLOC_CTX *memctx,
 
     /* FIXME - use ldb_val_dup() */
     for (i = 0; i < num_values; i++) {
-        var->vals[index].length = strlen((const char *) values[i].data);
-        var->vals[index].data = (uint8_t *) talloc_strdup(var,
+        var->vals[vi].length = strlen((const char *) values[i].data);
+        var->vals[vi].data = (uint8_t *) talloc_strdup(var,
                                           (const char *) values[i].data);
-        if (var->vals[index].data == NULL) {
+        if (var->vals[vi].data == NULL) {
             return LDB_ERR_OPERATIONS_ERROR;
         }
-        index++;
+        vi++;
     }
 
     return LDB_SUCCESS;
-- 
1.8.0.2

_______________________________________________
sssd-devel mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to