summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-08-15 17:14:33 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-08-15 17:14:33 (GMT)
commitf95dd0a2986392d4f51bb1dd17db50ff40aa90d5 (patch)
tree9a8a9c569d68b7bbdfde292bd66a5b71fa62dc02 /Modules
parent834a85a235020379935418510c0043f08a08a2a5 (diff)
downloadcpython-f95dd0a2986392d4f51bb1dd17db50ff40aa90d5.zip
cpython-f95dd0a2986392d4f51bb1dd17db50ff40aa90d5.tar.gz
cpython-f95dd0a2986392d4f51bb1dd17db50ff40aa90d5.tar.bz2
Fix portability problems with glibc 2.0, as reported in #449157.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_localemodule.c3
-rw-r--r--Modules/addrinfo.h7
-rw-r--r--Modules/getnameinfo.c4
-rw-r--r--Modules/socketmodule.c4
4 files changed, 17 insertions, 1 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 3f11054..7f7bdd2 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -527,6 +527,8 @@ init_locale(void)
ADDINT(ABMON_11);
ADDINT(ABMON_12);
+#ifdef RADIXCHAR
+ /* The following are not available with glibc 2.0 */
ADDINT(RADIXCHAR);
ADDINT(THOUSEP);
/* YESSTR and NOSTR are deprecated in glibc, since they are
@@ -537,6 +539,7 @@ init_locale(void)
ADDINT(NOSTR);
*/
ADDINT(CRNCYSTR);
+#endif
ADDINT(D_T_FMT);
ADDINT(D_FMT);
diff --git a/Modules/addrinfo.h b/Modules/addrinfo.h
index 6d0991d..686a4b8 100644
--- a/Modules/addrinfo.h
+++ b/Modules/addrinfo.h
@@ -67,6 +67,10 @@
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
#endif
+#endif /* HAVE_GETADDRINFO */
+
+#ifndef HAVE_GETNAMEINFO
+
/*
* Constants for getnameinfo()
*/
@@ -86,6 +90,8 @@
#define NI_DGRAM 0x00000010
#endif
+#endif /* HAVE_GETNAMEINFO */
+
#ifndef HAVE_ADDRINFO
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
@@ -137,4 +143,3 @@ extern void freehostent Py_PROTO((struct hostent *));
#ifdef __cplusplus
}
#endif
-#endif
diff --git a/Modules/getnameinfo.c b/Modules/getnameinfo.c
index 475b531..4827bc6 100644
--- a/Modules/getnameinfo.c
+++ b/Modules/getnameinfo.c
@@ -81,6 +81,10 @@ struct gni_sockinet {
#define ENI_FAMILY 5
#define ENI_SALEN 6
+/* forward declaration to make gcc happy */
+int getnameinfo Py_PROTO((const struct sockaddr *, size_t, char *, size_t,
+ char *, size_t, int));
+
int
getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
const struct sockaddr *sa;
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 16b81ac..525a19e 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -447,7 +447,11 @@ PyGAI_Err(int error)
if (error == EAI_SYSTEM)
return PySocket_Err();
+#ifdef HAVE_GAI_STRERROR
v = Py_BuildValue("(is)", error, gai_strerror(error));
+#else
+ v = Py_BuildValue("(is)", error, "getaddrinfo failed");
+#endif
if (v != NULL) {
PyErr_SetObject(PyGAI_Error, v);
Py_DECREF(v);