On Tue, Jul 21, 2020 at 3:50 PM Rosen Penev <ros...@gmail.com> wrote:
>
> The abs function takes a 32-bit int, which can cause truncation. Fixes
> compilation error:
>
> error: absolute value function 'abs' given an argu>
> if ((sec < 0) || (abs(cur.tv_sec - tv.tv_sec) > MAX_TIME_OFFSET)) {
Ping. This is still not applied.
>
> Signed-off-by: Rosen Penev <ros...@gmail.com>
> ---
>  nmea.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/nmea.c b/nmea.c
> index 8df7792..1204c20 100644
> --- a/nmea.c
> +++ b/nmea.c
> @@ -107,7 +107,7 @@ nmea_rmc_cb(void)
>
>                         gettimeofday(&cur, NULL);
>
> -                       if ((sec < 0) || (abs(cur.tv_sec - sec) > 
> MAX_TIME_OFFSET)) {
> +                       if ((sec < 0) || (llabs(cur.tv_sec - sec) > 
> MAX_TIME_OFFSET)) {
>                                 struct timeval tv = { 0 };
>                                 tv.tv_sec = sec;
>                                 if (++nmea_bad_time > MAX_BAD_TIME) {
> --
> 2.26.2
>

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to