@@ -250,7 +250,10 @@ ioctl_EVIOCGREP(PyObject *self, PyObject *args)
250250 ret = PyArg_ParseTuple (args , "i" , & fd );
251251 if (!ret ) return NULL ;
252252
253- ioctl (fd , EVIOCGREP , & rep );
253+ ret = ioctl (fd , EVIOCGREP , & rep );
254+ if (ret == -1 )
255+ return NULL ;
256+
254257 return Py_BuildValue ("(ii)" , rep [0 ], rep [1 ]);
255258}
256259
@@ -265,6 +268,9 @@ ioctl_EVIOCSREP(PyObject *self, PyObject *args)
265268 if (!ret ) return NULL ;
266269
267270 ret = ioctl (fd , EVIOCSREP , & rep );
271+ if (ret == -1 )
272+ return NULL ;
273+
268274 return Py_BuildValue ("i" , ret );
269275}
270276
@@ -277,6 +283,9 @@ ioctl_EVIOCGVERSION(PyObject *self, PyObject *args)
277283 if (!ret ) return NULL ;
278284
279285 ret = ioctl (fd , EVIOCGVERSION , & res );
286+ if (ret == -1 )
287+ return NULL ;
288+
280289 return Py_BuildValue ("i" , res );
281290}
282291
@@ -338,6 +347,9 @@ ioctl_EVIOCG_bits(PyObject *self, PyObject *args)
338347 break ;
339348 }
340349
350+ if (ret == -1 )
351+ return NULL ;
352+
341353 PyObject * res = PyList_New (0 );
342354 for (int i = 0 ; i < max ; i ++ ) {
343355 if (test_bit (bytes , i )) {
@@ -357,6 +369,9 @@ ioctl_EVIOCGEFFECTS(PyObject *self, PyObject *args)
357369 if (!ret ) return NULL ;
358370
359371 ret = ioctl (fd , EVIOCGEFFECTS , & res );
372+ if (ret == -1 )
373+ return NULL ;
374+
360375 return Py_BuildValue ("i" , res );
361376}
362377
@@ -381,7 +396,7 @@ void print_ff_effect(struct ff_effect* effect) {
381396 effect -> u .constant .envelope .attack_level ,
382397 effect -> u .constant .envelope .fade_length ,
383398 effect -> u .constant .envelope .fade_level );
384-
399+ break ;
385400 case FF_RUMBLE :
386401 fprintf (stderr , " rumble: (%d, %d)\n" ,
387402 effect -> u .rumble .strong_magnitude ,
0 commit comments