BUILD: server: fix build warnings introduced by load-server-state

Commit e11cfcd ("MINOR: config: new backend directives:
load-server-state-from-file and server-state-file-name") caused these
warnings when building with Clang :

src/server.c:1972:21: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                            (srv_uweight < 0) || (srv_uweight > SRV_UWGHT_MAX))
                             ~~~~~~~~~~~ ^ ~
src/server.c:1980:21: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                            (srv_iweight < 0) || (srv_iweight > SRV_UWGHT_MAX))
                             ~~~~~~~~~~~ ^ ~

Indeed, srv_iweight and srv_uweight are unsigned. Just drop the offending test.
This commit is contained in:
Willy Tarreau 2015-09-29 18:32:57 +02:00
parent ae459f3b9f
commit e1aebb2994

View File

@ -1968,16 +1968,14 @@ static void srv_update_state(struct server *srv, int version, char **params)
p = NULL;
errno = 0;
srv_uweight = strtol(params[3], &p, 10);
if ((p == params[3]) || errno == EINVAL || errno == ERANGE ||
(srv_uweight < 0) || (srv_uweight > SRV_UWGHT_MAX))
if ((p == params[3]) || errno == EINVAL || errno == ERANGE || (srv_uweight > SRV_UWGHT_MAX))
chunk_appendf(msg, ", invalid srv_uweight value '%s'", params[3]);
/* validating srv_iweight */
p = NULL;
errno = 0;
srv_iweight = strtol(params[4], &p, 10);
if ((p == params[4]) || errno == EINVAL || errno == ERANGE ||
(srv_iweight < 0) || (srv_iweight > SRV_UWGHT_MAX))
if ((p == params[4]) || errno == EINVAL || errno == ERANGE || (srv_iweight > SRV_UWGHT_MAX))
chunk_appendf(msg, ", invalid srv_iweight value '%s'", params[4]);
/* validating srv_last_time_change */