Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Oct 2013 22:41:18 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r257404 - head/contrib/tcp_wrappers
Message-ID:  <201310302241.r9UMfIAS081616@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbruno
Date: Wed Oct 30 22:41:18 2013
New Revision: 257404
URL: http://svnweb.freebsd.org/changeset/base/257404

Log:
  Quiesce two warnings:
  
  1.  define the CODE * as const
  2.  restructure function to eliminate warning about exiting with no return.
      severity_map() never returns when it can't find an appropriate sysylog
      facility, and it longjmp()'s away into error code handling.  Keep this
      behavior by stashing the facility value found during our search and
      checking for -1 if found.

Modified:
  head/contrib/tcp_wrappers/options.c

Modified: head/contrib/tcp_wrappers/options.c
==============================================================================
--- head/contrib/tcp_wrappers/options.c	Wed Oct 30 22:04:48 2013	(r257403)
+++ head/contrib/tcp_wrappers/options.c	Wed Oct 30 22:41:18 2013	(r257404)
@@ -443,16 +443,21 @@ struct request_info *request;
 /* severity_map - lookup facility or severity value */
 
 static int severity_map(table, name)
-CODE   *table;
+const CODE   *table;
 char   *name;
 {
-    CODE *t;
+    const CODE *t;
+    int ret = -1;
 
     for (t = table; t->c_name; t++)
-	if (STR_EQ(t->c_name, name))
-	    return (t->c_val);
-    tcpd_jump("bad syslog facility or severity: \"%s\"", name);
-    /* NOTREACHED */
+	if (STR_EQ(t->c_name, name)) {
+	    ret = t->c_val;
+	    break;
+	}
+    if (ret == -1)
+    	tcpd_jump("bad syslog facility or severity: \"%s\"", name);
+
+    return (ret);
 }
 
 /* severity_option - change logging severity for this event (Dave Mitchell) */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310302241.r9UMfIAS081616>