[Freeipa-devel] [PATCHES] Fix few gcc warnings

Lukas Slebodnik lslebodn at redhat.com
Fri Nov 13 08:32:59 UTC 2015


ehlo,

Few simple patches are attached.

LS
-------------- next part --------------
>From e7320a93df1f20e6f29e0a067187e70b41c10ef8 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Thu, 12 Nov 2015 19:25:15 +0000
Subject: [PATCH 2/8] ipa_kdb_tests: Remove unused variables

---
 daemons/ipa-kdb/tests/ipa_kdb_tests.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/daemons/ipa-kdb/tests/ipa_kdb_tests.c b/daemons/ipa-kdb/tests/ipa_kdb_tests.c
index 9f577529c7f8a22da2bb1a01898e804b6bc6d259..59e69d0c645026e5ce0884431b85486e599a3af0 100644
--- a/daemons/ipa-kdb/tests/ipa_kdb_tests.c
+++ b/daemons/ipa-kdb/tests/ipa_kdb_tests.c
@@ -126,9 +126,6 @@ void setup(void **state)
                         &ipa_ctx->mspac->trusts[0].sid_blacklist_incoming[0]);
     assert_int_equal(ret, 0);
 
-    struct dom_sid *sid_blacklist_incoming;
-    int len_sid_blacklist_incoming;
-
     ipa_ctx->kcontext = krb5_ctx;
     kerr = krb5_db_set_context(krb5_ctx, ipa_ctx);
     assert_int_equal(kerr, 0);
@@ -317,7 +314,6 @@ void test_get_authz_data_types(void **state)
     char *ad_none_and_pad[] = {"NONE", "PAD", NULL};
     char *ad_global_pac_nfs_none[] = {"MS-PAC", "nfs:NONE", NULL};
     char *ad_global_pac_nfs_pad[] = {"MS-PAC", "nfs:PAD", NULL};
-    krb5_context krb5_ctx;
     krb5_error_code kerr;
     struct ipadb_context *ipa_ctx;
     krb5_principal nfs_princ;
-- 
2.5.0

-------------- next part --------------
>From 935e22dc78f20e732cca0895899acae8ee233e10 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Thu, 12 Nov 2015 19:32:06 +0000
Subject: [PATCH 3/8] ipa_kdb_tests: Fix warning Wmissing-braces
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

tests/ipa_kdb_tests.c:254:9: warning: missing braces around initializer [-Wmissing-braces]
         {3, {BLACKLIST_SID"-1000", BLACKLIST_SID"-1001", BLACKLIST_SID"-1002"},
         ^
tests/ipa_kdb_tests.c:254:9: note: (near initialization for ‘test_data[6]’)
tests/ipa_kdb_tests.c:256:9: warning: missing braces around initializer [-Wmissing-braces]
         {0, NULL, 0 , NULL}
         ^
tests/ipa_kdb_tests.c:256:9: note: (near initialization for ‘test_data[7]’)
tests/ipa_kdb_tests.c:234:21: warning: missing braces around initializer [-Wmissing-braces]
     } test_data[] = {
                     ^
---
 daemons/ipa-kdb/tests/ipa_kdb_tests.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/daemons/ipa-kdb/tests/ipa_kdb_tests.c b/daemons/ipa-kdb/tests/ipa_kdb_tests.c
index 59e69d0c645026e5ce0884431b85486e599a3af0..7483a1799d4c8462f212ff6e8e4140c1c053d6a7 100644
--- a/daemons/ipa-kdb/tests/ipa_kdb_tests.c
+++ b/daemons/ipa-kdb/tests/ipa_kdb_tests.c
@@ -252,8 +252,8 @@ void test_filter_logon_info(void **state)
          1, {DOM_SID_TRUST"-1002"}},
         /* all SIDs filtered*/
         {3, {BLACKLIST_SID"-1000", BLACKLIST_SID"-1001", BLACKLIST_SID"-1002"},
-         0, NULL},
-        {0, NULL, 0 , NULL}
+         0, {}},
+        {0, {}, 0 , {}}
     };
 
     for (c = 0; test_data[c].sidcount != 0; c++) {
-- 
2.5.0

-------------- next part --------------
>From 215fd247ff9a6136c17228bf5e7369cb3f478512 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Thu, 12 Nov 2015 19:49:16 +0000
Subject: [PATCH 4/8] topology: Fix warning Wshadow
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

topology_pre.c: In function ‘ipa_topo_pre_add’:
topology_pre.c:509:15: warning: declaration of ‘errtxt’ shadows a previous local [-Wshadow]
         char *errtxt;
               ^
topology_pre.c:494:11: note: shadowed declaration is here
     char *errtxt  = NULL;
           ^
---
 daemons/ipa-slapi-plugins/topology/topology_pre.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/daemons/ipa-slapi-plugins/topology/topology_pre.c b/daemons/ipa-slapi-plugins/topology/topology_pre.c
index c6c22be24e9ef4d48e9a62e59ef20d7fb049568f..1788c6d3e9d95543d905054d9d1f31c40dddc045 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_pre.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_pre.c
@@ -506,7 +506,6 @@ int ipa_topo_pre_add(Slapi_PBlock *pb)
 
     if (ipa_topo_is_entry_managed(pb)) {
         int rc = LDAP_UNWILLING_TO_PERFORM;
-        char *errtxt;
         errtxt = slapi_ch_smprintf("Entry is managed by topology plugin."
                                    " Adding of entry not allowed.\n");
         slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errtxt);
-- 
2.5.0

-------------- next part --------------
>From 6d494c1c02914fd9c169b980b1e01d14061bb729 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Fri, 13 Nov 2015 06:51:59 +0000
Subject: [PATCH 5/8] ipa-extdom-extop: Fix warning Wformat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In file included from ipa_extdom_extop.c:41:0:
ipa_extdom_extop.c: In function ‘ipa_extdom_init_ctx’:
ipa_extdom_extop.c:203:9: warning: format ‘%d’ expects argument of type ‘int’,
                          but argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
     LOG("Maximal nss buffer size set to [%d]!\n", ctx->max_nss_buf_size);
         ^
../common/util.h:53:21: note: in definition of macro ‘LOG_PLUGIN_NAME’
                     fmt, ##__VA_ARGS__)
                     ^
ipa_extdom_extop.c:203:5: note: in expansion of macro ‘LOG’
---
 daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_extop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_extop.c b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_extop.c
index 708d0e4a2fc9da4f87a24a49c945587049f7280f..bc25e7643cdebe0eadc0cee4dcba3a392fdc33be 100644
--- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_extop.c
+++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_extop.c
@@ -200,7 +200,7 @@ static int ipa_extdom_init_ctx(Slapi_PBlock *pb, struct ipa_extdom_ctx **_ctx)
     if (ctx->max_nss_buf_size == 0) {
         ctx->max_nss_buf_size = DEFAULT_MAX_NSS_BUFFER;
     }
-    LOG("Maximal nss buffer size set to [%d]!\n", ctx->max_nss_buf_size);
+    LOG("Maximal nss buffer size set to [%zu]!\n", ctx->max_nss_buf_size);
 
     ret = 0;
 
-- 
2.5.0



More information about the Freeipa-devel mailing list