URL: https://github.com/freeipa/freeipa/pull/1626
Author: tiran
 Title: #1626: Silence some GCC warnings
Action: opened

PR body:
"""
The ipadb_free() and ipadb_alloc() functions are only used with
KRB5_KDB_DAL_MAJOR_VERSION 5.

```
ipa_extdom_common.c:103:5: warning: enumeration value ‘NSS_STATUS_RETURN’ not 
handled in switch [-Wswitch]
ipa_kdb.c:639:13: warning: ‘ipadb_free’ defined but not used [-Wunused-function]
ipa_kdb.c:634:14: warning: ‘ipadb_alloc’ defined but not used 
[-Wunused-function]
```

Signed-off-by: Christian Heimes <chei...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1626/head:pr1626
git checkout pr1626
From 511ae84cee785640a0dfe024e1a19cdda8a11b59 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Fri, 23 Feb 2018 10:04:26 +0100
Subject: [PATCH] Silence some GCC warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The ipadb_free() and ipadb_alloc() functions are only used with
KRB5_KDB_DAL_MAJOR_VERSION 5.

ipa_extdom_common.c:103:5: warning: enumeration value ‘NSS_STATUS_RETURN’ not handled in switch [-Wswitch]
ipa_kdb.c:639:13: warning: ‘ipadb_free’ defined but not used [-Wunused-function]
ipa_kdb.c:634:14: warning: ‘ipadb_alloc’ defined but not used [-Wunused-function]

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 daemons/ipa-kdb/ipa_kdb.c                                      | 2 ++
 daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/daemons/ipa-kdb/ipa_kdb.c b/daemons/ipa-kdb/ipa_kdb.c
index 222900ae7a..00c732624b 100644
--- a/daemons/ipa-kdb/ipa_kdb.c
+++ b/daemons/ipa-kdb/ipa_kdb.c
@@ -631,6 +631,7 @@ static krb5_error_code ipadb_get_age(krb5_context kcontext,
     return 0;
 }
 
+#if KRB5_KDB_DAL_MAJOR_VERSION == 5
 static void *ipadb_alloc(krb5_context context, void *ptr, size_t size)
 {
     return realloc(ptr, size);
@@ -640,6 +641,7 @@ static void ipadb_free(krb5_context context, void *ptr)
 {
     free(ptr);
 }
+#endif
 
 /* KDB Virtual Table */
 
diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
index 1b93dce186..525487c9e4 100644
--- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
+++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
@@ -109,9 +109,9 @@ int __nss_to_err(enum nss_status errcode)
         return ERANGE;
     case NSS_STATUS_UNAVAIL:
         return ETIMEDOUT;
+    default:
+        return -1;
     }
-
-    return -1;
 }
 
 int getpwnam_r_wrapper(struct ipa_extdom_ctx *ctx, const char *name,
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to