svn commit: r277857 - head/usr.sbin/ppp
Dimitry Andric
dim at FreeBSD.org
Wed Jan 28 21:33:51 UTC 2015
Author: dim
Date: Wed Jan 28 21:33:49 2015
New Revision: 277857
URL: https://svnweb.freebsd.org/changeset/base/277857
Log:
Fix multiple instances of the following clang 3.6.0 warning in ppp:
usr.sbin/ppp/command.c:2054:74: error: address of array 'arg->bundle->radius.cfg.file'
will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
if (arg->bundle->radius.alive.interval && !arg->bundle->radius.cfg.file) {
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
In all cases, the file field of struct radius is a char array, but the
intent was to check whether the string is empty, so add an indirection
to achieve that. Use a similar approach for the sockname field of
struct server.
Modified:
head/usr.sbin/ppp/command.c
head/usr.sbin/ppp/ipcp.c
head/usr.sbin/ppp/ipv6cp.c
head/usr.sbin/ppp/radius.c
head/usr.sbin/ppp/server.c
Modified: head/usr.sbin/ppp/command.c
==============================================================================
--- head/usr.sbin/ppp/command.c Wed Jan 28 21:21:35 2015 (r277856)
+++ head/usr.sbin/ppp/command.c Wed Jan 28 21:33:49 2015 (r277857)
@@ -2051,7 +2051,7 @@ SetVariable(struct cmdargs const *arg)
res = 1;
} else {
arg->bundle->radius.alive.interval = atoi(argp);
- if (arg->bundle->radius.alive.interval && !arg->bundle->radius.cfg.file) {
+ if (arg->bundle->radius.alive.interval && !*arg->bundle->radius.cfg.file) {
log_Printf(LogWARN, "rad_alive requires radius to be configured\n");
res = 1;
} else if (arg->bundle->ncp.ipcp.fsm.state == ST_OPENED) {
@@ -2335,7 +2335,7 @@ SetVariable(struct cmdargs const *arg)
res = 1;
}
- if (arg->bundle->radius.port_id_type && !arg->bundle->radius.cfg.file) {
+ if (arg->bundle->radius.port_id_type && !*arg->bundle->radius.cfg.file) {
log_Printf(LogWARN, "rad_port_id requires radius to be configured\n");
res = 1;
}
Modified: head/usr.sbin/ppp/ipcp.c
==============================================================================
--- head/usr.sbin/ppp/ipcp.c Wed Jan 28 21:21:35 2015 (r277856)
+++ head/usr.sbin/ppp/ipcp.c Wed Jan 28 21:33:49 2015 (r277857)
@@ -880,7 +880,7 @@ IpcpLayerDown(struct fsm *fp)
radius_Account(&fp->bundle->radius, &fp->bundle->radacct,
fp->bundle->links, RAD_STOP, &ipcp->throughput);
- if (fp->bundle->radius.cfg.file && fp->bundle->radius.filterid)
+ if (*fp->bundle->radius.cfg.file && fp->bundle->radius.filterid)
system_Select(fp->bundle, fp->bundle->radius.filterid, LINKDOWNFILE,
NULL, NULL);
radius_StopTimer(&fp->bundle->radius);
@@ -949,7 +949,7 @@ IpcpLayerUp(struct fsm *fp)
radius_Account(&fp->bundle->radius, &fp->bundle->radacct, fp->bundle->links,
RAD_START, &ipcp->throughput);
- if (fp->bundle->radius.cfg.file && fp->bundle->radius.filterid)
+ if (*fp->bundle->radius.cfg.file && fp->bundle->radius.filterid)
system_Select(fp->bundle, fp->bundle->radius.filterid, LINKUPFILE,
NULL, NULL);
radius_StartTimer(fp->bundle);
Modified: head/usr.sbin/ppp/ipv6cp.c
==============================================================================
--- head/usr.sbin/ppp/ipv6cp.c Wed Jan 28 21:21:35 2015 (r277856)
+++ head/usr.sbin/ppp/ipv6cp.c Wed Jan 28 21:33:49 2015 (r277857)
@@ -486,7 +486,7 @@ ipv6cp_LayerUp(struct fsm *fp)
* evaluated.
*/
if (!Enabled(fp->bundle, OPT_IPCP)) {
- if (fp->bundle->radius.cfg.file && fp->bundle->radius.filterid)
+ if (*fp->bundle->radius.cfg.file && fp->bundle->radius.filterid)
system_Select(fp->bundle, fp->bundle->radius.filterid, LINKUPFILE,
NULL, NULL);
}
@@ -539,7 +539,7 @@ ipv6cp_LayerDown(struct fsm *fp)
* evaluated.
*/
if (!Enabled(fp->bundle, OPT_IPCP)) {
- if (fp->bundle->radius.cfg.file && fp->bundle->radius.filterid)
+ if (*fp->bundle->radius.cfg.file && fp->bundle->radius.filterid)
system_Select(fp->bundle, fp->bundle->radius.filterid, LINKDOWNFILE,
NULL, NULL);
}
Modified: head/usr.sbin/ppp/radius.c
==============================================================================
--- head/usr.sbin/ppp/radius.c Wed Jan 28 21:21:35 2015 (r277856)
+++ head/usr.sbin/ppp/radius.c Wed Jan 28 21:33:49 2015 (r277857)
@@ -1345,7 +1345,7 @@ radius_alive(void *v)
void
radius_StartTimer(struct bundle *bundle)
{
- if (bundle->radius.cfg.file && bundle->radius.alive.interval) {
+ if (*bundle->radius.cfg.file && bundle->radius.alive.interval) {
bundle->radius.alive.timer.func = radius_alive;
bundle->radius.alive.timer.name = "radius alive";
bundle->radius.alive.timer.load = bundle->radius.alive.interval * SECTICKS;
Modified: head/usr.sbin/ppp/server.c
==============================================================================
--- head/usr.sbin/ppp/server.c Wed Jan 28 21:21:35 2015 (r277856)
+++ head/usr.sbin/ppp/server.c Wed Jan 28 21:33:49 2015 (r277857)
@@ -248,7 +248,7 @@ server_LocalOpen(struct bundle *bundle,
oldmask = (mode_t)-1; /* Silence compiler */
- if (server.cfg.sockname && !strcmp(server.cfg.sockname, name))
+ if (server.cfg.sockname[0] != '\0' && !strcmp(server.cfg.sockname, name))
server_Close(bundle);
memset(&ifsun, '\0', sizeof ifsun);
More information about the svn-src-all
mailing list