aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2010-03-05 22:20:42 +0100
committerMatthias Andree <matthias.andree@gmx.de>2010-03-05 22:20:42 +0100
commit7af830a55a6cb82ff4f7e1102f28e1def1b2e193 (patch)
tree1e6e3720d9f8ac6d872dcb362c08f6dadd10f68a
parentc41317d22a0cc6a673dfc226d890e18f60ca5883 (diff)
downloadfetchmail-7af830a55a6cb82ff4f7e1102f28e1def1b2e193.tar.gz
fetchmail-7af830a55a6cb82ff4f7e1102f28e1def1b2e193.tar.bz2
fetchmail-7af830a55a6cb82ff4f7e1102f28e1def1b2e193.zip
Properly check for h_errno declaration and include netdb.h.
-rw-r--r--NEWS2
-rw-r--r--configure.ac7
-rw-r--r--mx.h12
-rw-r--r--socket.c10
4 files changed, 19 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index 0c269510..fbb15ed8 100644
--- a/NEWS
+++ b/NEWS
@@ -66,6 +66,8 @@ fetchmail 6.3.15 (not yet released):
* Check seteuid() return value and abort running MDA if switch fails.
* Set global flags in a consistent manner. Make --nosoftbounce work. Reported by
N.J. Mann.
+* Properly import h_errno declarations, even on systems where h_errno isn't a
+ macro. (Adds ./configure check, fixes Cygwin dllimport warnings.)
# CHANGES
* The repository has been converted and moved from the Subversion (SVN) format
diff --git a/configure.ac b/configure.ac
index c6a4b98d..428fc3d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,13 @@ AC_CHECK_HEADERS([resolv.h],,,[
#endif
])
+AC_CHECK_DECLS([h_errno],,,[
+ AC_INCLUDES_DEFAULT
+ #ifdef HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+])
+
AC_C_CONST dnl getopt needs this.
AM_PROG_LEX
diff --git a/mx.h b/mx.h
index da422758..3bb1e34a 100644
--- a/mx.h
+++ b/mx.h
@@ -2,6 +2,12 @@
* For license terms, see the file COPYING in this directory.
*/
+#include "config.h"
+
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
struct mxentry
{
char *name;
@@ -10,10 +16,8 @@ struct mxentry
extern struct mxentry * getmxrecords(const char *);
-/* some versions of FreeBSD should declare this but don't */
-/* But only declare it if it isn't already */
-#ifndef h_errno
+#if !HAVE_DECL_H_ERRNO
extern int h_errno;
-#endif /* ndef h_errno */
+#endif
/* mx.h ends here */
diff --git a/socket.c b/socket.c
index adc4f585..f987040a 100644
--- a/socket.c
+++ b/socket.c
@@ -75,15 +75,9 @@ static ssize_t cygwin_read(int sock, void *buf, size_t count);
/* We need to define h_errno only if it is not already */
#ifndef h_errno
-
-#ifdef HAVE_RES_SEARCH
-/* some versions of FreeBSD should declare this but don't */
+# if !HAVE_DECL_H_ERRNO
extern int h_errno;
-#else
-/* pretend we have h_errno to avoid some #ifdef's later */
-static int h_errno;
-#endif
-
+# endif
#endif /* ndef h_errno */
#ifdef HAVE_SOCKETPAIR