summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlon Bar-Lev <alon.barlev@gmail.com>2012-03-29 11:16:39 +0200
committerDavid Sommerseth <davids@redhat.com>2012-04-02 11:54:01 +0200
commit112731fcc39535ba425ac717cb0d5bd1a2a11c61 (patch)
tree03d5cbc35637b79607293caf391c5fbcd49574cd
parent5cfe3d4c1897785b32565dbb59c914fac62b0ed9 (diff)
downloadopenvpn-112731fcc39535ba425ac717cb0d5bd1a2a11c61.tar.gz
openvpn-112731fcc39535ba425ac717cb0d5bd1a2a11c61.tar.xz
openvpn-112731fcc39535ba425ac717cb0d5bd1a2a11c61.zip
cleanup: avoid using ~0 - generic
Use limits.h for maximum value. Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com> Acked-by: Gert Doering <gert@greenie.muc.de> Signed-off-by: David Sommerseth <davids@redhat.com>
-rw-r--r--config-msvc.h1
-rw-r--r--configure.ac2
-rw-r--r--src/openvpn/route.c2
-rw-r--r--src/openvpn/syshead.h4
4 files changed, 7 insertions, 2 deletions
diff --git a/config-msvc.h b/config-msvc.h
index 0e42505..99c00f9 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 ef34697..e962323 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 bf7af63..a628e77 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 e60dc44..0595b67 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -129,6 +129,10 @@
#include <signal.h>
#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif