]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC r274900:
authordim <dim@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 25 Nov 2014 13:29:13 +0000 (13:29 +0000)
committerdim <dim@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 25 Nov 2014 13:29:13 +0000 (13:29 +0000)
commit28e9b0e36debef8b1fac700c87994cd3af4d7ab6
tree4c864714a8ee9baac787870fa66c03b2ddbed875
parent977e1b9e3539e7f60da43062c5e46131b40d0bc6
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.

git-svn-id: svn://svn.freebsd.org/base/stable/8@275039 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c