From 5b3d62a7a6d4354b1588dd94f477c44bd15f1753 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 27 Apr 2009 17:35:04 -0400 Subject: [PATCH] Misc networking build fixes http://bugzilla.gnome.org/show_bug.cgi?id=580301 http://bugzilla.gnome.org/show_bug.cgi?id=584176 --- gio/gnetworkaddress.c | 8 +------- gio/gnetworkingprivate.h | 8 +++++++- gio/gresolver.c | 2 +- gio/gsocket.c | 8 +------- gio/gsocketcontrolmessage.c | 5 +---- gio/gunixresolver.c | 1 - gio/gunixsocketaddress.c | 2 -- gio/libasyncns/g-asyncns.h | 17 +++++++++++++++++ 8 files changed, 28 insertions(+), 23 deletions(-) diff --git a/gio/gnetworkaddress.c b/gio/gnetworkaddress.c index 3e09db0d2..09df3dbf2 100644 --- a/gio/gnetworkaddress.c +++ b/gio/gnetworkaddress.c @@ -29,19 +29,13 @@ #include "gasyncresult.h" #include "ginetaddress.h" #include "ginetsocketaddress.h" +#include "gnetworkingprivate.h" #include "gresolver.h" #include "gsimpleasyncresult.h" #include "gsocketaddressenumerator.h" #include "gioerror.h" #include "gsocketconnectable.h" -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_WINSOCK2_H -#include -#endif - #include #include "gioalias.h" diff --git a/gio/gnetworkingprivate.h b/gio/gnetworkingprivate.h index 868845166..b6a811a68 100644 --- a/gio/gnetworkingprivate.h +++ b/gio/gnetworkingprivate.h @@ -28,15 +28,21 @@ #undef interface #include #include +#include #else /* !G_OS_WIN32 */ +#include #include #include -#if HAVE_ARPA_NAMESER_COMPAT_H +#if defined(HAVE_ARPA_NAMESER_COMPAT_H) && !defined(GETSHORT) #include #endif +#ifndef T_SRV +#define T_SRV 33 +#endif + /* We're supposed to define _GNU_SOURCE to get EAI_NODATA, but that * won't actually work since has already been included at * this point. So we define __USE_GNU instead. diff --git a/gio/gresolver.c b/gio/gresolver.c index e7a17546a..3f2f59847 100644 --- a/gio/gresolver.c +++ b/gio/gresolver.c @@ -636,7 +636,7 @@ g_resolver_error_from_addrinfo_error (gint err) switch (err) { case EAI_FAIL: -#ifndef G_OS_WIN32 /* defined as NONAME claiming it is removed from rfc2553bis */ +#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) case EAI_NODATA: #endif case EAI_NONAME: diff --git a/gio/gsocket.c b/gio/gsocket.c index 9c40c6d0f..102e5d245 100644 --- a/gio/gsocket.c +++ b/gio/gsocket.c @@ -34,15 +34,8 @@ #include #ifndef G_OS_WIN32 -# include -# include -# include # include # include -# include -#else -# include -# include #endif #include "gsocket.h" @@ -53,6 +46,7 @@ #include "gioerror.h" #include "gioenums.h" #include "gioerror.h" +#include "gnetworkingprivate.h" #include "glibintl.h" #include "gioalias.h" diff --git a/gio/gsocketcontrolmessage.c b/gio/gsocketcontrolmessage.c index 4400d006c..f576a3467 100644 --- a/gio/gsocketcontrolmessage.c +++ b/gio/gsocketcontrolmessage.c @@ -44,14 +44,11 @@ #include "config.h" #include "gsocketcontrolmessage.h" +#include "gnetworkingprivate.h" #include "glibintl.h" #ifndef G_OS_WIN32 #include "gunixfdmessage.h" -#include -#else -# include -# include #endif #include "gioalias.h" diff --git a/gio/gunixresolver.c b/gio/gunixresolver.c index 34d7c1c98..a1f742523 100644 --- a/gio/gunixresolver.c +++ b/gio/gunixresolver.c @@ -24,7 +24,6 @@ #include #include "glibintl.h" -#include #include #include diff --git a/gio/gunixsocketaddress.c b/gio/gunixsocketaddress.c index 43c4920cc..89cc64309 100644 --- a/gio/gunixsocketaddress.c +++ b/gio/gunixsocketaddress.c @@ -24,8 +24,6 @@ #include #include #include -#include -#include #include "gunixsocketaddress.h" #include "glibintl.h" diff --git a/gio/libasyncns/g-asyncns.h b/gio/libasyncns/g-asyncns.h index a40fadb2c..e741fcb6a 100644 --- a/gio/libasyncns/g-asyncns.h +++ b/gio/libasyncns/g-asyncns.h @@ -21,8 +21,25 @@ #include "config.h" #define _GNU_SOURCE + +/* We want to build the fork-based version, not the threaded version. */ #undef HAVE_PTHREAD +/* libasyncns doesn't actually need this include, and it breaks + * old OS X. #580301. Remove if asyncns.c stops including + * in the future. + */ +#undef HAVE_ARPA_NAMESER_COMPAT_H + +/* Also for old OS X, #580301. Remove if these are added to asyncns.c + * in the future. + */ +#include +#include + +/* Some BSDs require this for getrlimit */ +#include + #include "asyncns.h" #endif