From: Alon Bar-Lev Date: Thu, 29 Mar 2012 09:16:39 +0000 (+0200) Subject: cleanup: avoid using ~0 - generic X-Git-Tag: v2.3_alpha2~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=112731fcc39535ba425ac717cb0d5bd1a2a11c61;p=thirdparty%2Fopenvpn.git cleanup: avoid using ~0 - generic Use limits.h for maximum value. Signed-off-by: Alon Bar-Lev Acked-by: Gert Doering Signed-off-by: David Sommerseth --- diff --git a/config-msvc.h b/config-msvc.h index 0e4250513..99c00f9fc 100644 --- a/config-msvc.h +++ b/config-msvc.h @@ -30,6 +30,7 @@ #define HAVE_STRERROR 1 #define HAVE_STRINGS_H 1 #define HAVE_STRING_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_SYSTEM 1 #define HAVE_TIME 1 #define HAVE_TIME_H 1 diff --git a/configure.ac b/configure.ac index ef346978a..e962323f5 100644 --- a/configure.ac +++ b/configure.ac @@ -354,7 +354,7 @@ AX_EMPTY_ARRAY AC_CHECK_SIZEOF([unsigned int]) AC_CHECK_SIZEOF([unsigned long]) AC_CHECK_HEADERS([ \ - stdio.h stdarg.h \ + stdio.h stdarg.h limits.h \ time.h errno.h fcntl.h io.h direct.h \ ctype.h sys/types.h sys/socket.h \ signal.h unistd.h dlfcn.h \ diff --git a/src/openvpn/route.c b/src/openvpn/route.c index bf7af6318..a628e774f 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -2386,7 +2386,7 @@ get_default_gateway (struct route_gateway_info *rgi) { char line[256]; int count = 0; - unsigned int lowest_metric = ~0; + unsigned int lowest_metric = UINT_MAX; in_addr_t best_gw = 0; bool found = false; while (fgets (line, sizeof (line), fp) != NULL) diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h index e60dc44d6..0595b67d2 100644 --- a/src/openvpn/syshead.h +++ b/src/openvpn/syshead.h @@ -129,6 +129,10 @@ #include #endif +#ifdef HAVE_LIMITS_H +#include +#endif + #ifdef HAVE_STDIO_H #include #endif