chiark / gitweb /
terminal: remove dead code checking O_WRONLY
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 16 Sep 2014 21:00:26 +0000 (23:00 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Tue, 16 Sep 2014 21:01:48 +0000 (23:01 +0200)
We only reject evdev FDs that are O_WRONLY as they're currently pretty
useless. The following check for O_WRONLY is thus never excercised so drop
it.
Thanks to Thomas Andersen (via coverity)!

src/libsystemd-terminal/idev-evdev.c

index 6509d1011e59e1f5e6738e651240fafad52be6b8..18c48ee59259ab16319427619ece2854994fc27f 100644 (file)
@@ -314,11 +314,7 @@ static int idev_evdev_resume(idev_evdev *evdev, int dev_fd) {
                 return -EACCES;
 
         evdev->element.readable = true;
-        evdev->element.writable = true;
-        if (flags == O_RDONLY)
-                evdev->element.writable = false;
-        else if (flags == O_WRONLY)
-                evdev->element.readable = false;
+        evdev->element.writable = !(flags & O_RDONLY);
 
         /*
          * TODO: We *MUST* re-sync the device so we get a delta of the changed