Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Feb 2016 02:08:55 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r295192 - user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools
Message-ID:  <201602030208.u1328tHh055096@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602030208.u1328tHh055096>