]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
This is barry-scott's patch:
authorMichael W. Hudson <mwh@python.net>
Wed, 27 Jul 2005 20:24:40 +0000 (20:24 +0000)
committerMichael W. Hudson <mwh@python.net>
Wed, 27 Jul 2005 20:24:40 +0000 (20:24 +0000)
1231069 ] ioctl has problem with -ive request codes

by using the 'I' not the 'i' format code to PyArg_ParseTuple().

Backport candidate?  Maybe...

Misc/NEWS
Modules/fcntlmodule.c

index f168fa1ab145a7a44ab3c5f1cf52b737d52ca689..1bbec3929fc42a5f5d87ffad77bf113b845c0110 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -117,6 +117,10 @@ Core and builtins
 Extension Modules
 -----------------
 
+- Patch #1231069: The fcntl.ioctl function now uses the 'I' code for
+  the request code argument, which results in more C-like behaviour
+  for large or negative values.
+
 - Bug #1234979: For the argument of thread.Lock.acquire, the Windows
   implemented treated all integer values except 1 as false.
 
index 54f3a2eb272001df1d300a6bcbcf95c05fdb45ca..eb5189ef41306961aa4b916fc8324a27b88afe41 100644 (file)
@@ -102,7 +102,7 @@ fcntl_ioctl(PyObject *self, PyObject *args)
        int mutate_arg = 1;
        char buf[1024];
 
-       if (PyArg_ParseTuple(args, "O&iw#|i:ioctl",
+       if (PyArg_ParseTuple(args, "O&Iw#|i:ioctl",
                              conv_descriptor, &fd, &code, 
                             &str, &len, &mutate_arg)) {
                char *arg;
@@ -151,7 +151,7 @@ fcntl_ioctl(PyObject *self, PyObject *args)
        }
 
        PyErr_Clear();
-       if (PyArg_ParseTuple(args, "O&is#:ioctl",
+       if (PyArg_ParseTuple(args, "O&Is#:ioctl",
                              conv_descriptor, &fd, &code, &str, &len)) {
                if (len > sizeof buf) {
                        PyErr_SetString(PyExc_ValueError,
@@ -172,7 +172,7 @@ fcntl_ioctl(PyObject *self, PyObject *args)
        PyErr_Clear();
        arg = 0;
        if (!PyArg_ParseTuple(args,
-            "O&i|i;ioctl requires a file or file descriptor,"
+            "O&I|i;ioctl requires a file or file descriptor,"
             " an integer and optionally a integer or buffer argument",
                              conv_descriptor, &fd, &code, &arg)) {
          return NULL;