Skip to content

Commit

Permalink
pythongh-69214: Fix fcntl.ioctl() request type (python#119498)
Browse files Browse the repository at this point in the history
Use an 'unsigned long' instead of an 'unsigned int' for the request
parameter of fcntl.ioctl() to support requests larger than UINT_MAX.
  • Loading branch information
vstinner authored May 24, 2024
1 parent b48a3db commit 92fab33
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix ``fcntl.ioctl()`` *request* parameter: use an ``unsigned long`` instead of
an ``unsigned int`` for the *request* parameter of :func:`fcntl.ioctl` to
support requests larger than ``UINT_MAX``. Patch by Victor Stinner.
11 changes: 6 additions & 5 deletions Modules/clinic/fcntlmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Modules/fcntlmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ fcntl_fcntl_impl(PyObject *module, int fd, int code, PyObject *arg)
fcntl.ioctl
fd: fildes
request as code: unsigned_int(bitwise=True)
request as code: unsigned_long(bitwise=True)
arg as ob_arg: object(c_default='NULL') = 0
mutate_flag as mutate_arg: bool = True
/
Expand Down Expand Up @@ -148,9 +148,9 @@ code.
[clinic start generated code]*/

static PyObject *
fcntl_ioctl_impl(PyObject *module, int fd, unsigned int code,
fcntl_ioctl_impl(PyObject *module, int fd, unsigned long code,
PyObject *ob_arg, int mutate_arg)
/*[clinic end generated code: output=7f7f5840c65991be input=967b4a4cbeceb0a8]*/
/*[clinic end generated code: output=3d8eb6828666cea1 input=cee70f6a27311e58]*/
{
#define IOCTL_BUFSZ 1024
/* We use the unsigned non-checked 'I' format for the 'code' parameter
Expand Down

0 comments on commit 92fab33

Please sign in to comment.