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
Dimitry Andric
dim at FreeBSD.org
Tue Nov 25 13:29:15 UTC 2014
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/9/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c
Directory Properties:
stable/9/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/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c
stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c
Directory Properties:
stable/10/ (props changed)
stable/7/usr.sbin/bsnmpd/ (props changed)
stable/8/usr.sbin/bsnmpd/ (props changed)
Modified: stable/9/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c
==============================================================================
--- stable/9/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c Tue Nov 25 13:12:45 2014 (r275038)
+++ stable/9/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c Tue Nov 25 13:29:13 2014 (r275039)
@@ -201,8 +201,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);
}
More information about the svn-src-stable-9
mailing list