summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-08-29 16:05:04 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-08-29 16:09:27 +1000
commitf75d74ef55071f157950d339222179bb6582649a (patch)
treee61a0da40ab84d42e4d03ffb534f7201d240bcd2 /src
parent39507ef9eab2f48fda02f62d019e1cb172e74f18 (diff)
device: If we can't open the device, it's not the one we want
well, or at least we're not sure whether it is, so... Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'src')
-rw-r--r--src/device.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/device.cpp b/src/device.cpp
index 5868036..50d0c28 100644
--- a/src/device.cpp
+++ b/src/device.cpp
@@ -69,6 +69,9 @@ static bool event_is_device(const std::string &path,
bool equal = false;
int fd = open(path.c_str(), O_RDONLY);
+ if (fd == -1)
+ return false;
+
if (ioctl(fd, EVIOCGNAME(sizeof(device_name)), device_name) != -1 &&
devname.compare(device_name) == 0) {
struct stat buf;