From: Sami Kerola Date: Tue, 23 Aug 2016 18:25:40 +0000 (+0100) Subject: portability: fix float max check from values.h X-Git-Tag: v0.88~27^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a06fb26c94df0c6cac0ff92257b15c87be24a9d;p=thirdparty%2Fmtr.git portability: fix float max check from values.h MacOS does not have values.h file. --- diff --git a/configure.ac b/configure.ac index 9fceaa9..5369ec4 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,7 @@ AC_CHECK_HEADERS([ \ sys/socket.h \ sys/types.h \ sys/xti.h \ + values.h \ ]) # Check functions. diff --git a/mtr.c b/mtr.c index 3358c4a..47f5d2a 100644 --- a/mtr.c +++ b/mtr.c @@ -27,7 +27,9 @@ #include #include #include +#ifdef HAVE_VALUES_H #include +#endif #include #include @@ -209,8 +211,11 @@ strtofloat_or_err (const char *str, const char *errmesg) if (str != NULL && *str != '\0') { errno = 0; num = strtod (str, &end); - if (errno == 0 && str != end && end != NULL && *end == '\0' && - num < FLT_MAX) + if (errno == 0 && str != end && end != NULL && *end == '\0' +#ifdef FLT_MAX + && num < FLT_MAX +#endif + ) return num; } error (EXIT_FAILURE, errno, "%s: '%s'", errmesg, str);