[PATCH libevdev 2/3] tools: shut up coverity about a potential close(-1)

Peter Hutterer peter.hutterer at who-t.net
Sun Jan 3 13:53:10 PST 2016


On Sat, Dec 26, 2015 at 04:27:29PM +0100, David Herrmann wrote:
> Hey
> 
> On Tue, Dec 22, 2015 at 1:01 AM, Peter Hutterer
> <peter.hutterer at who-t.net> wrote:
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> >  tools/libevdev-tweak-device.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/libevdev-tweak-device.c b/tools/libevdev-tweak-device.c
> > index 4be2d6f..bdc16e6 100644
> > --- a/tools/libevdev-tweak-device.c
> > +++ b/tools/libevdev-tweak-device.c
> > @@ -376,7 +376,8 @@ main(int argc, char **argv)
> >         int led = -1;
> >         int led_state = -1;
> >         unsigned int changes = 0; /* bitmask of changes */
> > -       int xres, yres;
> > +       int xres = 0,
> > +           yres =0;
> 
> Missing whitespace and.. rebase mistake? Looks misplaced in this commit.
 
whoops, thanks. fixed and pushed.

Cheers,
   Peter
 
> >         mode = parse_options_mode(argc, argv, &path);
> >         switch (mode) {
> > @@ -434,7 +435,8 @@ main(int argc, char **argv)
> >
> >  out:
> >         libevdev_free(dev);
> > -       close(fd);
> > +       if (fd != -1)
> > +               close(fd);
> >
> >         return rc;
> >  }
> > --
> > 2.5.0


More information about the Input-tools mailing list