input: fix kmscon_input_device_wakeup protection
We cannot check for dev->fd as the fd is only set when the input device has keys. Therefore check for rfd now. Also remove the NULL check in *_sleep() as it is not needed. All public APIs allow passing NULL. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
18d829bd39
commit
75339df698
@ -160,7 +160,7 @@ int kmscon_input_device_wake_up(struct kmscon_input_device *device)
|
||||
if (!device || !device->input || !device->input->eloop)
|
||||
return -EINVAL;
|
||||
|
||||
if (device->fd)
|
||||
if (device->rfd >= 0)
|
||||
return 0;
|
||||
|
||||
device->rfd = open(device->devnode, O_CLOEXEC | O_NONBLOCK | O_RDONLY);
|
||||
@ -204,9 +204,7 @@ void kmscon_input_device_sleep(struct kmscon_input_device *device)
|
||||
if (device->rfd < 0)
|
||||
return;
|
||||
|
||||
if (device->features & FEATURE_HAS_KEYS)
|
||||
ev_eloop_rm_fd(device->fd);
|
||||
|
||||
ev_eloop_rm_fd(device->fd);
|
||||
device->fd = NULL;
|
||||
close(device->rfd);
|
||||
device->rfd = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user