On Wed, 2013-01-09 at 08:45 -0500, Simo Sorce wrote:
> On Wed, 2013-01-09 at 08:38 -0500, Simo Sorce wrote:
> > On Wed, 2013-01-09 at 08:35 -0500, Simo Sorce wrote:
> > > On Wed, 2013-01-09 at 11:37 +0100, Jakub Hrozek wrote:
> > > > On Wed, Jan 09, 2013 at 11:31:53AM +0100, Jakub Hrozek wrote:
> > > > > On Wed, Jan 09, 2013 at 10:51:34AM +0100, Sumit Bose wrote:
> > > > > > Hi,
> > > > > > 
> > > > > > a switch statement which was introduced with "Remove unhelpful 
> > > > > > vtable
> > > > > > from sss_cache" has a missing default section which results in a
> > > > > > compiler warning about an uninitialized variable. The attached patch
> > > > > > should fix it.
> > > > > > 
> > > > > > bye,
> > > > > > Sumit
> > > > > 
> > > > > I don't see the warning even though I seem to be using very similar
> > > > > CFLAGS to Sumit's. But the patch is correct, Ack.
> > > > 
> > > > I fixed a typo in the commit message (s/swtich/switch) and pushed to
> > > > patch to master.
> > > 
> > > I will send a revert with the correct fix! :-(
> > 
> > Revert + fix case.
> 
> Actually I amended the patch to add a default of type_String = "unknown"
> which will be (I hope) more explicative thana "(NULL)" in the log.

At Sumit's request another respin to also make the function static.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York
>From 480195bd70467bf05e2fd92cf25cec822a670ced Mon Sep 17 00:00:00 2001
From: Simo Sorce <s...@redhat.com>
Date: Wed, 9 Jan 2013 08:35:51 -0500
Subject: [PATCH] Revert "Add a default section to a switch-statement"

This reverts commit d698499602461b98fd56f2d550f80c6cb25f12a9.

And adds the correct fix.
Also makes the function static,as it is used nowehere else.
---
 src/tools/sss_cache.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index 5cced0c2b58dd81650db11bb41bb9202e5361309..748f2683355a4151fc0e3fceadd9853c4530c57f 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -82,9 +82,9 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain);
 errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx);
 errno_t invalidate_entry(TALLOC_CTX *ctx, struct sysdb_ctx *sysdb,
                          const char *name, int entry_type);
-bool invalidate_entries(TALLOC_CTX *ctx, struct sysdb_ctx *sysdb,
-                        enum sss_cache_entry entry_type, const char *filter,
-                        const char *name);
+static bool invalidate_entries(TALLOC_CTX *ctx, struct sysdb_ctx *sysdb,
+                               enum sss_cache_entry entry_type,
+                               const char *filter, const char *name);
 static errno_t update_all_filters(struct cache_tool_ctx *tctx,
                                   char *domain_name);
 
@@ -274,16 +274,15 @@ static errno_t update_all_filters(struct cache_tool_ctx *tctx,
     return EOK;
 }
 
-
-bool invalidate_entries(TALLOC_CTX *ctx, struct sysdb_ctx *sysdb,
-                        enum sss_cache_entry entry_type, const char *filter,
-                        const char *name)
+static bool invalidate_entries(TALLOC_CTX *ctx, struct sysdb_ctx *sysdb,
+                               enum sss_cache_entry entry_type,
+                               const char *filter, const char *name)
 {
     const char *attrs[] = {SYSDB_NAME, NULL};
     size_t msg_count;
     struct ldb_message **msgs;
-    const char *type_string = NULL;
-    errno_t ret;
+    const char *type_string = "unknown";
+    errno_t ret = EINVAL;
     int i;
     const char *c_name;
     bool iret;
@@ -314,9 +313,6 @@ bool invalidate_entries(TALLOC_CTX *ctx, struct sysdb_ctx *sysdb,
         type_string = "autofs map";
         ret = search_autofsmaps(ctx, sysdb, filter, attrs, &msg_count, &msgs);
         break;
-    default:
-        DEBUG(SSSDBG_OP_FAILURE, ("Unknown entry type [%d].\n", entry_type));
-        return false;
     }
 
     if (ret != EOK) {
-- 
1.8.0.1

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to