summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-05-28 20:18:18 (GMT)
committerGuido van Rossum <guido@python.org>1998-05-28 20:18:18 (GMT)
commit578de30fd71c592ff434d7fe238a1f657a3802f4 (patch)
tree99cd4279cfcdaf29dccedf79ca02b72d8a60cf0d /Modules
parent617c1b0116891c3cbb6b10865e86d48e93fefdf0 (diff)
downloadcpython-578de30fd71c592ff434d7fe238a1f657a3802f4.zip
cpython-578de30fd71c592ff434d7fe238a1f657a3802f4.tar.gz
cpython-578de30fd71c592ff434d7fe238a1f657a3802f4.tar.bz2
Some systems (e.g. Linux) use enums for some symbols (like IPPROTO_IP)
so that our #ifdef test has the wrong effect. Substitute hardcoded values for some important symbols (but not for the whole range -- some are pretty obscure so it's not worth it).
Diffstat (limited to 'Modules')
-rw-r--r--Modules/socketmodule.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 92001df..c200b2d 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1668,14 +1668,19 @@ initsocket()
#endif
/* Protocol level and numbers, usable for [gs]etsockopt */
+/* Sigh -- some systems (e.g. Linux) use enums for these. */
#ifdef SOL_SOCKET
insint(d, "SOL_SOCKET", SOL_SOCKET);
#endif
#ifdef IPPROTO_IP
insint(d, "IPPROTO_IP", IPPROTO_IP);
+#else
+ insint(d, "IPPROTO_IP", 0);
#endif
#ifdef IPPROTO_ICMP
insint(d, "IPPROTO_ICMP", IPPROTO_ICMP);
+#else
+ insint(d, "IPPROTO_ICMP", 1);
#endif
#ifdef IPPROTO_IGMP
insint(d, "IPPROTO_IGMP", IPPROTO_IGMP);
@@ -1685,6 +1690,8 @@ initsocket()
#endif
#ifdef IPPROTO_TCP
insint(d, "IPPROTO_TCP", IPPROTO_TCP);
+#else
+ insint(d, "IPPROTO_TCP", 6);
#endif
#ifdef IPPROTO_EGP
insint(d, "IPPROTO_EGP", IPPROTO_EGP);
@@ -1694,6 +1701,8 @@ initsocket()
#endif
#ifdef IPPROTO_UDP
insint(d, "IPPROTO_UDP", IPPROTO_UDP);
+#else
+ insint(d, "IPPROTO_UDP", 17);
#endif
#ifdef IPPROTO_IDP
insint(d, "IPPROTO_IDP", IPPROTO_IDP);
@@ -1719,6 +1728,8 @@ initsocket()
/**/
#ifdef IPPROTO_RAW
insint(d, "IPPROTO_RAW", IPPROTO_RAW);
+#else
+ insint(d, "IPPROTO_RAW", 255);
#endif
#ifdef IPPROTO_MAX
insint(d, "IPPROTO_MAX", IPPROTO_MAX);