Author: ngie
Date: Sat May 14 23:13:23 2016
New Revision: 299774
URL: https://svnweb.freebsd.org/changeset/base/299774

Log:
  Do minimal work necessary to cure a -Wunused-but-set-variable warning from gcc
  
  How errno is saved before and restored after strtoul calls needs a rethink
  
  MFC after: 1 week
  Reported by: gcc 5.x
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
==============================================================================
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c  Sat May 14 23:10:47 
2016        (r299773)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c  Sat May 14 23:13:23 
2016        (r299774)
@@ -778,11 +778,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;
+               errno = saved_errno;
                warnx("Integer value %s not supported", val);
                return (-1);
        } else
-               saved_errno = errno;
+               errno = saved_errno;
 
        if (*endptr != '.') {
                warnx("Failed reading octet - %s", val);
@@ -799,11 +799,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;
+               errno = saved_errno;
                warnx("Integer value %s not supported", val);
                return (-1);
        } else
-               saved_errno = errno;
+               errno = saved_errno;
 
        for (i = 0, d = 1000; i < 4; i++) {
                ntp_ts[i + 4] = v / d;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to