Skip to content

Commit cb41241

Browse files
authored
Add #ifdef guards around UI_GET_SYSNAME (#218)
If the C code is built with a kernel header that does not provide UI_GET_SYSNAME, then ui_get_sysname() will always raise OSError. (Unless incorrect arguments are provided to the function, in which case the function still behaves as it otherwise would.)
1 parent 5fb3190 commit cb41241

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

evdev/uinput.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ uinput_get_sysname(PyObject *self, PyObject *args)
106106
int ret = PyArg_ParseTuple(args, "i", &fd);
107107
if (!ret) return NULL;
108108

109+
#ifdef UI_GET_SYSNAME
109110
if (ioctl(fd, UI_GET_SYSNAME(sizeof(sysname)), &sysname) < 0)
110111
goto on_err;
111112

112113
return Py_BuildValue("s", &sysname);
114+
#endif
113115

114116
on_err:
115117
PyErr_SetFromErrno(PyExc_OSError);

0 commit comments

Comments
 (0)