ports/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules-fcntlmodule.c
Stephen Montgomery-Smith 7869f4665f - Replace python-2.7.5 with version 2.7.6. Thus the port should now build
on FreeBSD-10 and higher.
- Use the patches from the lang/python27 port.
- Bump portrevision.
2014-05-31 05:05:23 +00:00

56 lines
2.3 KiB
C

--- /dev/null 2014-05-31 00:44:00.000000000 +0000
+++ build/pkgs/python/fbsd-patch-src_Modules-fcntlmodule.c 2014-05-31 00:35:21.000000000 +0000
@@ -0,0 +1,53 @@
+--- src/Modules/fcntlmodule.c.orig 2010-08-14 16:36:54.991363730 +0800
++++ src/Modules/fcntlmodule.c 2010-08-14 16:41:05.555822031 +0800
+@@ -97,20 +97,15 @@
+ {
+ #define IOCTL_BUFSZ 1024
+ int fd;
+- /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I'
++ /* In PyArg_ParseTuple below, we use the unsigned non-checked 'k'
+ format for the 'code' parameter because Python turns 0x8000000
+ into either a large positive number (PyLong or PyInt on 64-bit
+ platforms) or a negative number on others (32-bit PyInt)
+ whereas the system expects it to be a 32bit bit field value
+ regardless of it being passed as an int or unsigned long on
+- various platforms. See the termios.TIOCSWINSZ constant across
+- platforms for an example of thise.
+-
+- If any of the 64bit platforms ever decide to use more than 32bits
+- in their unsigned long ioctl codes this will break and need
+- special casing based on the platform being built on.
++ various platforms.
+ */
+- unsigned int code;
++ unsigned long code;
+ int arg;
+ int ret;
+ char *str;
+@@ -118,7 +113,7 @@
+ int mutate_arg = 1;
+ char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */
+
+- if (PyArg_ParseTuple(args, "O&Iw#|i:ioctl",
++ if (PyArg_ParseTuple(args, "O&kw#|i:ioctl",
+ conv_descriptor, &fd, &code,
+ &str, &len, &mutate_arg)) {
+ char *arg;
+@@ -169,7 +164,7 @@
+ }
+
+ PyErr_Clear();
+- if (PyArg_ParseTuple(args, "O&Is#:ioctl",
++ if (PyArg_ParseTuple(args, "O&ks#:ioctl",
+ conv_descriptor, &fd, &code, &str, &len)) {
+ if (len > IOCTL_BUFSZ) {
+ PyErr_SetString(PyExc_ValueError,
+@@ -191,7 +186,7 @@
+ PyErr_Clear();
+ arg = 0;
+ if (!PyArg_ParseTuple(args,
+- "O&I|i;ioctl requires a file or file descriptor,"
++ "O&k|i;ioctl requires a file or file descriptor,"
+ " an integer and optionally an integer or buffer argument",
+ conv_descriptor, &fd, &code, &arg)) {
+ return NULL;