summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 1c19c28..863a407 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1789,9 +1789,6 @@ gethost_common(struct hostent *h, struct sockaddr *addr, int alen, int af)
if (h == NULL) {
/* Let's get real error message to return */
-#ifndef h_errno
- extern int h_errno;
-#endif
PyH_Err(h_errno);
return NULL;
}
@@ -2348,7 +2345,11 @@ PySocket_getaddrinfo(PyObject *self, PyObject *args)
return NULL;
}
if (PyInt_Check(pobj)) {
+#ifndef HAVE_SNPRINTF
+ sprintf(pbuf, "%ld", PyInt_AsLong(pobj));
+#else
snprintf(pbuf, sizeof(pbuf), "%ld", PyInt_AsLong(pobj));
+#endif
pptr = pbuf;
} else if (PyString_Check(pobj)) {
pptr = PyString_AsString(pobj);
@@ -2419,7 +2420,11 @@ PySocket_getnameinfo(PyObject *self, PyObject *args)
n = PyArg_ParseTuple(sa, "si|ii", &hostp, &port, &flowinfo, scope_id);
if (n == 0)
goto fail;
+#ifdef HAVE_SPRINTF
snprintf(pbuf, sizeof(pbuf), "%d", port);
+#else
+ sprintf(pbuf, "%d", port);
+#endif
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
error = getaddrinfo(hostp, pbuf, &hints, &res);