Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Nov 2014 13:29:16 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r275039 - in stable: 10/usr.sbin/bsnmpd/modules/snmp_hostres 7/usr.sbin/bsnmpd/modules/snmp_hostres 8/usr.sbin/bsnmpd/modules/snmp_hostres 9/usr.sbin/bsnmpd/modules/snmp_hostres
Message-ID:  <201411251329.sAPDTGwM061892@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Tue Nov 25 13:29:13 2014
New Revision: 275039
URL: https://svnweb.freebsd.org/changeset/base/275039

Log:
  MFC r274900:
  
  Fix the following -Werror warnings from clang 3.5.0, while building
  bsnmpd's snmp_hostres module:
  
  usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:204:20: error: absolute value function 'abs' given an argument of type 'const long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
          str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600);
                            ^
  usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:204:20: note: use function 'labs' instead
          str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600);
                            ^~~
                            labs
  usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:205:22: error: absolute value function 'abs' given an argument of type 'const long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
          str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60);
                              ^
  usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:205:22: note: use function 'labs' instead
          str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60);
                              ^~~
                              labs
  
  Since tm::tm_gmtoff is a long, use labs(3) instead.

Modified:
  stable/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c
Directory Properties:
  stable/7/usr.sbin/bsnmpd/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c
  stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c
  stable/9/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c
Directory Properties:
  stable/10/   (props changed)
  stable/8/usr.sbin/bsnmpd/   (props changed)
  stable/9/usr.sbin/bsnmpd/   (props changed)

Modified: stable/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c
==============================================================================
--- stable/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c	Tue Nov 25 13:12:45 2014	(r275038)
+++ stable/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c	Tue Nov 25 13:29:13 2014	(r275039)
@@ -202,8 +202,8 @@ make_date_time(u_char *str, const struct
 	else
 		str[8] = '+';
 
-	str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600);
-	str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60);
+	str[9] = (u_char)(labs(tm->tm_gmtoff) / 3600);
+	str[10] = (u_char)((labs(tm->tm_gmtoff) % 3600) / 60);
 
 	return (11);
 }



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