diff options
author | sbruno <sbruno@FreeBSD.org> | 2013-10-30 22:41:18 +0000 |
---|---|---|
committer | sbruno <sbruno@FreeBSD.org> | 2013-10-30 22:41:18 +0000 |
commit | a6adb4d71be1c22edce2dccf2f526d593dc01d86 (patch) | |
tree | 597adae45a4336da9690493922b3fbc13dad139c /contrib/tcp_wrappers | |
parent | 2a8a5e773d3a4b23aed81a780ccb156cac13920f (diff) | |
download | FreeBSD-src-a6adb4d71be1c22edce2dccf2f526d593dc01d86.zip FreeBSD-src-a6adb4d71be1c22edce2dccf2f526d593dc01d86.tar.gz |
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.
Diffstat (limited to 'contrib/tcp_wrappers')
-rw-r--r-- | contrib/tcp_wrappers/options.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/contrib/tcp_wrappers/options.c b/contrib/tcp_wrappers/options.c index 249f57a..04ae174 100644 --- a/contrib/tcp_wrappers/options.c +++ b/contrib/tcp_wrappers/options.c @@ -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) */ |