freebsd-dev/usr.sbin/rtadvd
Dimitry Andric f28c40aee0 Fix the following -Werror warnings from clang 3.5.0, while building
usr.sbin/rtadvd:

usr.sbin/rtadvd/rtadvd.c:1291:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1291:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^~~
usr.sbin/rtadvd/rtadvd.c:1324:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1324:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^~~
2 errors generated.

These warnings occur because both preferred_time and pfx_pltimeexpire
are uint32_t's, so the subtraction expression is also unsigned, and
calling abs() is a no-op.

However, the intention was to look at the absolute difference between
the two unsigned quantities.  Introduce a small static function to
clarify what we're doing, and call that instead.

Reviewed by:	hrs
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D1197
2014-11-22 23:04:33 +00:00
..
advcap.c Fix off-by-one. 2014-10-11 23:08:00 +00:00
advcap.h
config.c Check buffer length more strictly. 2014-10-11 23:24:09 +00:00
config.h - Improve interface list handling. The rtadvd(8) now supports dynamically- 2011-07-17 19:24:54 +00:00
control_client.c - Fix a bug that can lead to displaying an incorrect value. (r224210) 2011-09-12 23:52:55 +00:00
control_client.h - Fix a bug that can lead to displaying an incorrect value. (r224210) 2011-09-12 23:52:55 +00:00
control_server.c - Fix a bug that can lead to displaying an incorrect value. (r224210) 2011-09-12 23:52:55 +00:00
control_server.h - Fix a bug that can lead to displaying an incorrect value. (r224210) 2011-09-12 23:52:55 +00:00
control.c - Fix a bug that can lead to displaying an incorrect value. (r224210) 2011-09-12 23:52:55 +00:00
control.h - Fix a bug that can lead to displaying an incorrect value. (r224210) 2011-09-12 23:52:55 +00:00
if.c Ignore if the interface is not IPv6-capable. 2013-09-02 20:44:19 +00:00
if.h - Improve interface list handling. The rtadvd(8) now supports dynamically- 2011-07-17 19:24:54 +00:00
Makefile - Improve interface list handling. The rtadvd(8) now supports dynamically- 2011-07-17 19:24:54 +00:00
pathnames.h - Improve interface list handling. The rtadvd(8) now supports dynamically- 2011-07-17 19:24:54 +00:00
rrenum.c - Use time_uptime instead of time_second in data structures for 2013-08-05 20:13:02 +00:00
rrenum.h - Implement RDNSS and DNSSL options (RFC 6106, IPv6 Router Advertisement 2011-06-06 03:06:43 +00:00
rtadvd.8 - Implement and use usage(). 2013-02-25 16:47:09 +00:00
rtadvd.c Fix the following -Werror warnings from clang 3.5.0, while building 2014-11-22 23:04:33 +00:00
rtadvd.conf - Implement RDNSS and DNSSL options (RFC 6106, IPv6 Router Advertisement 2011-06-06 03:06:43 +00:00
rtadvd.conf.5 mdoc: correct .Bd/.Bl arguments. 2012-03-26 21:22:53 +00:00
rtadvd.h - Use time_uptime instead of time_second in data structures for 2013-08-05 20:13:02 +00:00
timer_subr.c - Use time_uptime instead of time_second in data structures for 2013-08-05 20:13:02 +00:00
timer_subr.h - Use time_uptime instead of time_second in data structures for 2013-08-05 20:13:02 +00:00
timer.c Fix build on arm and mips. 2013-08-06 15:49:18 +00:00
timer.h - Use time_uptime instead of time_second in data structures for 2013-08-05 20:13:02 +00:00