svn commit: r257404 - head/contrib/tcp_wrappers

Sean Bruno sbruno at FreeBSD.org
Wed Oct 30 22:41:18 UTC 2013


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) */


More information about the svn-src-head mailing list