aboutsummaryrefslogtreecommitdiff
path: root/ares
diff options
context:
space:
mode:
Diffstat (limited to 'ares')
-rw-r--r--ares/ares_process.c6
-rw-r--r--ares/configure.ac12
-rw-r--r--ares/setup_once.h26
3 files changed, 39 insertions, 5 deletions
diff --git a/ares/ares_process.c b/ares/ares_process.c
index 480948ebe..6b1b07154 100644
--- a/ares/ares_process.c
+++ b/ares/ares_process.c
@@ -54,10 +54,6 @@
#include "ares_dns.h"
#include "ares_private.h"
-#ifndef TRUE
-/* at least Solaris 7 does not have TRUE at this point */
-#define TRUE 1
-#endif
static int try_again(int errnum);
static void write_tcp_data(ares_channel channel, fd_set *write_fds,
@@ -532,7 +528,7 @@ static int nonblock(ares_socket_t sockfd, /* operate on this */
int flags;
flags = fcntl(sockfd, F_GETFL, 0);
- if (TRUE == nonblock)
+ if (FALSE != nonblock)
return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
else
return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));
diff --git a/ares/configure.ac b/ares/configure.ac
index 0165c5e90..e870d63d2 100644
--- a/ares/configure.ac
+++ b/ares/configure.ac
@@ -308,6 +308,8 @@ AC_CHECK_HEADERS(
netdb.h \
netinet/in.h \
net/if.h \
+ errno.h \
+ stdbool.h \
arpa/nameser.h \
arpa/nameser_compat.h \
arpa/inet.h,
@@ -369,6 +371,16 @@ fi
AC_CHECK_TYPE(ssize_t, ,
AC_DEFINE(ssize_t, int, [the signed version of size_t]))
+# check for bool type
+AC_CHECK_TYPE([bool],[
+ AC_DEFINE(HAVE_BOOL_T, 1,
+ [Define to 1 if bool is an available type.])
+], ,[
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif
+])
+
# Check for socklen_t or equivalent
CURL_CHECK_TYPE_SOCKLEN_T
diff --git a/ares/setup_once.h b/ares/setup_once.h
index 20ea3819d..6911f1bcf 100644
--- a/ares/setup_once.h
+++ b/ares/setup_once.h
@@ -62,6 +62,10 @@
#include <fcntl.h>
#endif
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif
+
/*
* Definition of timeval struct for platforms that don't have it.
@@ -177,6 +181,28 @@ struct timeval {
/*
+ * Typedef to 'unsigned char' if bool is not an available 'typedefed' type.
+ */
+
+#ifndef HAVE_BOOL_T
+typedef unsigned char bool;
+#define HAVE_BOOL_T
+#endif
+
+
+/*
+ * Default definition of uppercase TRUE and FALSE.
+ */
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+
+/*
* Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type.
*/