summaryrefslogtreecommitdiff
path: root/lang/python24/files
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2010-07-19 21:59:28 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2010-07-19 21:59:28 +0000
commit5045cff4a059fb43d185e75ed1258eb9fbe4ca4b (patch)
tree20aff63270becd83fe367054a3d8fadbd2f72db4 /lang/python24/files
parentUpdate to new upstream release 5.0.26. (diff)
Fix fcntl module to accept 'unsigned long' type commands for ioctl(2).
Although POSIX says the type is 'int', all BSD variants (including Mac OS X) have been using 'unsigned long' type for very long time and its use predates the standard long enough. For certain commands (e.g., TIOCSWINSZ, FIONBIO), the Python value may get sign-extended on 64-bit platforms (by implicit type promotion) and it causes annoying warnings from kernel such as this: WARNING pid 24509 (python2.6): ioctl sign-extension ioctl ffffffff8004667e Approved by: python (maintainer timeout)
Notes
Notes: svn path=/head/; revision=257978
Diffstat (limited to 'lang/python24/files')
-rw-r--r--lang/python24/files/patch-Modules-fcntlmodule.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/lang/python24/files/patch-Modules-fcntlmodule.c b/lang/python24/files/patch-Modules-fcntlmodule.c
new file mode 100644
index 000000000000..e675a6be06b6
--- /dev/null
+++ b/lang/python24/files/patch-Modules-fcntlmodule.c
@@ -0,0 +1,38 @@
+--- Modules/fcntlmodule.c.orig 2006-09-27 15:17:32.000000000 -0400
++++ Modules/fcntlmodule.c 2010-06-24 21:15:48.000000000 -0400
+@@ -95,7 +95,7 @@
+ {
+ #define IOCTL_BUFSZ 1024
+ int fd;
+- int code;
++ unsigned long code;
+ int arg;
+ int ret;
+ char *str;
+@@ -103,7 +103,7 @@
+ int mutate_arg = 0;
+ 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;
+@@ -164,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,
+@@ -186,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 a integer or buffer argument",
+ conv_descriptor, &fd, &code, &arg)) {
+ return NULL;