[PATCH libevdev 3/3] uinput: explicitly ignore the UI_DEV_DESTROY return value

Peter Hutterer peter.hutterer at who-t.net
Sun Aug 24 17:04:11 PDT 2014


On Fri, Aug 22, 2014 at 05:00:19PM +0200, David Herrmann wrote:
> Hi
> 
> On Fri, Aug 22, 2014 at 4:56 AM, Peter Hutterer
> <peter.hutterer at who-t.net> wrote:
> > This can't fail in the kernel anyway, so cast it to shut up coverity.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> >  libevdev/libevdev-uinput.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libevdev/libevdev-uinput.c b/libevdev/libevdev-uinput.c
> > index ea2b025..33b5317 100644
> > --- a/libevdev/libevdev-uinput.c
> > +++ b/libevdev/libevdev-uinput.c
> > @@ -358,7 +358,7 @@ libevdev_uinput_destroy(struct libevdev_uinput *uinput_dev)
> >         if (!uinput_dev)
> >                 return;
> >
> > -       ioctl(uinput_dev->fd, UI_DEV_DESTROY, NULL);
> > +       (void)ioctl(uinput_dev->fd, UI_DEV_DESTROY, NULL);
> 
> iuhh... coverity shouldn't warn about ignored return values! This
> looks really ugly.. But sure, go ahead, I don't care that much.

Coverity's warning here was: "Calling function "ioctl(int, unsigned long,
..)" without checking return value (as is done elsewhere 35 out of 36
times)."

Which is quite a useful warning. I'll add it to the commit msg. Thanks for
the review!

Cheers,
   Peter


> 
> >         if (uinput_dev->fd_is_managed)
> >                 close(uinput_dev->fd);
> >         free(uinput_dev->syspath);
> > --
> > 1.9.3


More information about the Input-tools mailing list