Message233271
Good point, I updated the diff with a better cast to avoid endianness issues (tested on MIPS64) and added an OpenBSD #ifdef, is that more acceptable?
diff -r 88de50c1696b Modules/socketmodule.c
--- a/Modules/socketmodule.c Sun Dec 28 18:51:25 2014 +0200
+++ b/Modules/socketmodule.c Wed Dec 31 14:25:55 2014 -0500
@@ -1881,24 +1881,31 @@
{
int level;
int optname;
int res;
char *buf;
int buflen;
int flag;
if (PyArg_ParseTuple(args, "iii:setsockopt",
&level, &optname, &flag)) {
buf = (char *) &flag;
buflen = sizeof flag;
+#if defined(__OpenBSD__)
+ /* Multicast options take shorter arguments */
+ if (optname == IP_MULTICAST_TTL || optname == IP_MULTICAST_LOOP) {
+ buflen = sizeof(u_char);
+ *buf = (u_char)flag;
+ }
+#endif
}
else {
PyErr_Clear();
if (!PyArg_ParseTuple(args, "iis#:setsockopt",
&level, &optname, &buf, &buflen))
return NULL;
}
res = setsockopt(s->sock_fd, level, optname, (void *)buf, buflen);
if (res < 0)
return s->errorhandler();
Py_INCREF(Py_None);
return Py_None; |
|
Date |
User |
Action |
Args |
2014-12-31 19:36:24 | tamentis | set | recipients:
+ tamentis, benjamin.peterson |
2014-12-31 19:36:24 | tamentis | set | messageid: <1420054584.9.0.299527200418.issue23127@psf.upfronthosting.co.za> |
2014-12-31 19:36:24 | tamentis | link | issue23127 messages |
2014-12-31 19:36:24 | tamentis | create | |
|