[PATCH evdev] If stat fails, pretend it's not a virtual device

Peter Hutterer peter.hutterer at who-t.net
Tue Dec 4 23:13:24 PST 2012


If stat fails while checking if the device is virtual, just say "no, it's
not virtual" and continue. If the device really went away, it'll be removed
through other means.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
This patch is to shut up coverity

 src/evdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/evdev.c b/src/evdev.c
index 2aab97f..619bce6 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -308,7 +308,9 @@ EvdevDeviceIsVirtual(const char* devicenode)
     if (!udev)
         goto out;
 
-    stat(devicenode, &st);
+    if (stat(devicenode, &st) == -1)
+        goto out;
+
     device = udev_device_new_from_devnum(udev, 'c', st.st_rdev);
 
     if (!device)
-- 
1.7.11.7



More information about the xorg-devel mailing list