[SSSD] [PATCHES] Fix two compilation warnings

Sumit Bose sbose at redhat.com
Wed Dec 19 09:26:53 UTC 2012


Hi,

the following two patches fix gcc warnings I came across.

bye,
Sumit
-------------- next part --------------
From 914da6bfdb4bbeffac65bac7dc0c5fcc331d2772 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Wed, 19 Dec 2012 10:17:27 +0100
Subject: [PATCH 1/2] Fix a 'shadows a global declaration' warning

---
 src/db/sysdb_sudo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/db/sysdb_sudo.c b/src/db/sysdb_sudo.c
index 519a3aa..d50df0b 100644
--- a/src/db/sysdb_sudo.c
+++ b/src/db/sysdb_sudo.c
@@ -36,7 +36,7 @@
 
 /* ====================  Utility functions ==================== */
 
-static errno_t sysdb_sudo_convert_time(const char *str, time_t *time)
+static errno_t sysdb_sudo_convert_time(const char *str, time_t *unix_time)
 {
     struct tm tm;
     char *tret = NULL;
@@ -58,7 +58,7 @@ static errno_t sysdb_sudo_convert_time(const char *str, time_t *time)
     for (format = formats; *format != NULL; format++) {
         tret = strptime(str, *format, &tm);
         if (tret != NULL && *tret == '\0') {
-            *time = mktime(&tm);
+            *unix_time = mktime(&tm);
             return EOK;
         }
     }
-- 
1.7.7.6

-------------- next part --------------
From dbd330a80593c84db1ea44c23fe9baaa5ed0dc62 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Wed, 19 Dec 2012 10:19:01 +0100
Subject: [PATCH 2/2] Add default section to switch statement

switch statements should always have a default section. In this
particular case gcc gave a "'send_fn' may be used uninitialized in this
function" warning.
---
 src/providers/ldap/sdap_sudo.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c
index 53aa6d4..047ba58 100644
--- a/src/providers/ldap/sdap_sudo.c
+++ b/src/providers/ldap/sdap_sudo.c
@@ -1229,6 +1229,9 @@ static int sdap_sudo_schedule_refresh(TALLOC_CTX *mem_ctx,
     case SDAP_SUDO_REFRESH_RULES:
         DEBUG(SSSDBG_OP_FAILURE, ("Rules refresh can't be scheduled!\n"));
         return EINVAL;
+    default:
+        DEBUG(SSSDBG_CRIT_FAILURE, ("Unknown refresh type [%d].\n", refresh));
+        return EINVAL;
     }
 
 
-- 
1.7.7.6



More information about the sssd-devel mailing list