libevdev/0002-tools-shut-up-coverity-about-a-potential-close-1.patch
Peter Hutterer 6e98b3ce31 Fix a couple of coverity warnings
- Fix a potential race condition when checking uinput device's syspath
  (inactive in Fedora, we use the ioctl and never get here)
2015-12-22 09:31:18 +10:00

39 lines
977 B
Diff

From 683e52fb7529e3ce077c6d495932d6d3c09fcc0f Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 22 Dec 2015 09:18:37 +1000
Subject: [PATCH libevdev 2/3] tools: shut up coverity about a potential
close(-1)
Signed-off-by: Peter Hutterer <peter.hutterer@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;
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