summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-09-15 22:01:40 (GMT)
committerGuido van Rossum <guido@python.org>1999-09-15 22:01:40 (GMT)
commit9376b74c42d3d7361330c7a28d4ac65b6ace6cfb (patch)
tree870f5bdafb8ad64196ee4c1b73899bbf3ca975c9
parentba895d892d2fd129903a6c71b7b7b6814e70dd77 (diff)
downloadcpython-9376b74c42d3d7361330c7a28d4ac65b6ace6cfb.zip
cpython-9376b74c42d3d7361330c7a28d4ac65b6ace6cfb.tar.gz
cpython-9376b74c42d3d7361330c7a28d4ac65b6ace6cfb.tar.bz2
(1) On Linux, we really need to trust the configure script to select
the right variant of gethostbyname_r for us, since not all Linuxes are equal in this respect. Reported by Laurent Pointal. (2) On BeOS, Chris Herborth reports that instead of arpa/inet.h you must include net/netdb.h to get the inet_ntoa() and inet_addr() prototypes.
-rw-r--r--Modules/socketmodule.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 93a3b09..9dfc5d0 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -89,9 +89,16 @@ Socket methods:
#include "Python.h"
+/* Hacks for gethostbyname_r(). On some non-Linux platforms, the configure
+ script doesn't get this right, so we hardcode some platform checks below.
+ On the other hand, not all Linux versions agree, so there the settings
+ computed by the configure script are needed! */
+
+#ifndef linux
#undef HAVE_GETHOSTBYNAME_R_3_ARG
#undef HAVE_GETHOSTBYNAME_R_5_ARG
#undef HAVE_GETHOSTBYNAME_R_6_ARG
+#endif
#ifndef WITH_THREAD
#undef HAVE_GETHOSTBYNAME_R
@@ -103,7 +110,7 @@ Socket methods:
#elif defined(__sun__) || defined(__sgi)
#define HAVE_GETHOSTBYNAME_R_5_ARG
#elif defined(linux)
-#define HAVE_GETHOSTBYNAME_R_6_ARG
+/* Rely on the configure script */
#else
#undef HAVE_GETHOSTBYNAME_R
#endif
@@ -154,8 +161,12 @@ int shutdown( int, int );
#include <sys/socket.h>
#include <netinet/in.h>
-/* added 20 Aug 1999 to remove warnings from inet_ntoa call <che@debian.org> */
+/* Headers needed for inet_ntoa() and inet_addr() */
+#ifdef __BEOS__
+#include <net/netdb.h>
+#else
#include <arpa/inet.h>
+#endif
#include <fcntl.h>
#else