svn commit: r295192 - user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools
Garrett Cooper
ngie at FreeBSD.org
Wed Feb 3 02:08:56 UTC 2016
Author: ngie
Date: Wed Feb 3 02:08:55 2016
New Revision: 295192
URL: https://svnweb.freebsd.org/changeset/base/295192
Log:
Mute -Wsign-compare warnings
By definition parse_ascii(..) returns -1 to denote errors, but
snmp_client.clen and snmp_client.engine.engine_len are unsigned
quantities. Cast their values to signed quantities when doing
the compare, and check for -1 (the return code in the error case)
instead of <0
Reported by: Jenkins (clang job)
Sponsored by: EMC / Isilon Storage Division
Modified:
user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
Modified: user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
==============================================================================
--- user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Wed Feb 3 02:06:48 2016 (r295191)
+++ user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Wed Feb 3 02:08:55 2016 (r295192)
@@ -617,8 +617,8 @@ parse_context(struct snmp_toolinfo *snmp
warnx("Suboption 'context-engine' - no argument");
return (-1);
}
- if ((snmp_client.clen = parse_ascii(val,
- snmp_client.cengine, SNMP_ENGINE_ID_SIZ)) < 0) {
+ if ((int32_t)(snmp_client.clen = parse_ascii(val,
+ snmp_client.cengine, SNMP_ENGINE_ID_SIZ)) == -1) {
warnx("Bad EngineID - %s", val);
return (-1);
}
@@ -656,7 +656,7 @@ parse_user_security(struct snmp_toolinfo
}
snmp_client.engine.engine_len = parse_ascii(val,
snmp_client.engine.engine_id, SNMP_ENGINE_ID_SIZ);
- if (snmp_client.engine.engine_len < 0) {
+ if ((int32_t)snmp_client.engine.engine_len == -1) {
warnx("Bad EngineID - %s", val);
return (-1);
}
More information about the svn-src-user
mailing list