diff options
author | dim <dim@FreeBSD.org> | 2014-11-25 13:29:13 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-11-25 13:29:13 +0000 |
commit | b0242e0d0262e0b501e98ee8a3f8f924ced0dc92 (patch) | |
tree | e2275b7e61106c3155963f60a212cf23a1b8fd0d /usr.sbin/bsnmpd | |
parent | 10bfcc72ff17ef32e5b2e365e2c2ac6687813ae0 (diff) | |
download | FreeBSD-src-b0242e0d0262e0b501e98ee8a3f8f924ced0dc92.zip FreeBSD-src-b0242e0d0262e0b501e98ee8a3f8f924ced0dc92.tar.gz |
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.
Diffstat (limited to 'usr.sbin/bsnmpd')
-rw-r--r-- | usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c index c2a06db..26bd919 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c @@ -201,8 +201,8 @@ make_date_time(u_char *str, const struct tm *tm, u_int decisecs) 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); } |