From owner-svn-src-user@freebsd.org Thu Feb 4 08:52:50 2016 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CCBBA9B615 for ; Thu, 4 Feb 2016 08:52:50 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 521AD1C67; Thu, 4 Feb 2016 08:52:50 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u148qnP9003643; Thu, 4 Feb 2016 08:52:49 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u148qnkd003642; Thu, 4 Feb 2016 08:52:49 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201602040852.u148qnkd003642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 4 Feb 2016 08:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r295243 - user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2016 08:52:50 -0000 Author: ngie Date: Thu Feb 4 08:52:49 2016 New Revision: 295243 URL: https://svnweb.freebsd.org/changeset/base/295243 Log: - Delete `ptr` to fix -Wunused-but-set warnings - Fix `parse_ntp_ts` to use saved_errno properly to also mute -Wunused-but-set warnings. - Delete a few errant errno = 0 calls after calling strlcpy to let the error cases fail as designed if the strings passed in weren't base 10 numbers. - Make style a bit consistent with all blocks where `errno` is saved to `saved_errno`. Reported by: gcc 4.9.4 Modified: user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Modified: user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c ============================================================================== --- user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Thu Feb 4 08:42:33 2016 (r295242) +++ user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Thu Feb 4 08:52:49 2016 (r295243) @@ -777,11 +777,11 @@ parse_ntp_ts(struct snmp_value *sv, char saved_errno = errno; v = strtoul(val, &endptr, 10); if (errno != 0 || (v / 1000) > 9) { - saved_errno = errno; warnx("Integer value %s not supported", val); + errno = saved_errno; return (-1); } else - saved_errno = errno; + errno = saved_errno; if (*endptr != '.') { warnx("Failed reading octet - %s", val); @@ -798,11 +798,11 @@ parse_ntp_ts(struct snmp_value *sv, char saved_errno = errno; v = strtoul(val, &endptr, 10); if (errno != 0 || (v / 1000) > 9) { - saved_errno = errno; warnx("Integer value %s not supported", val); + errno = saved_errno; return (-1); } else - saved_errno = errno; + errno = saved_errno; for (i = 0, d = 1000; i < 4; i++) { ntp_ts[i + 4] = v / d; @@ -879,8 +879,6 @@ snmp_bridgeid2oct(char *str, struct asn_ /* Read the priority. */ saved_errno = errno; v = strtoul(ptr, &endptr, 10); - errno = 0; - if (v > SNMP_MAX_BRIDGE_PRIORITY || errno != 0 || *endptr != '.') { errno = saved_errno; warnx("Bad bridge priority value %d", v); @@ -928,12 +926,11 @@ snmp_bridgeid2oct(char *str, struct asn_ static int32_t parse_bridge_id(struct snmp_value *sv, char *string) { - char *ptr, *endptr; + char *endptr; int32_t i, saved_errno; uint32_t v; uint8_t bridge_id[SNMP_BRIDGEID_OCTETS]; - ptr = string; /* Read the priority. */ saved_errno = errno; errno = 0; @@ -1027,8 +1024,6 @@ snmp_bport_id2oct(char *str, struct asn_ /* Read the priority. */ saved_errno = errno; v = strtoul(ptr, &endptr, 10); - errno = 0; - if (v > SNMP_MAX_BPORT_PRIORITY || errno != 0 || *endptr != '.') { errno = saved_errno; warnx("Bad bridge port priority value %d", v); @@ -1056,12 +1051,11 @@ snmp_bport_id2oct(char *str, struct asn_ static int32_t parse_bport_id(struct snmp_value *value, char *string) { - char *ptr, *endptr; + char *endptr; int saved_errno; uint32_t v; uint8_t bport_id[SNMP_BPORT_OCTETS]; - ptr = string; /* Read the priority. */ saved_errno = errno; errno = 0; @@ -1215,7 +1209,6 @@ snmp_bits2oct(char *str, struct asn_oid saved_errno = errno; errno = 0; - v = strtoull(str, &endptr, 16); if (errno != 0) { warnx("Bad BITS value %s - %s", str, strerror(errno)); @@ -1254,9 +1247,7 @@ parse_bits(struct snmp_value *value, cha saved_errno = errno; errno = 0; - v = strtoull(string, &endptr, 16); - if (errno != 0) { warnx("Bad BITS value %s - %s", string, strerror(errno)); errno = saved_errno;