Skip to content

Commit

Permalink
sender: do not treat device disconnection as an error
Browse files Browse the repository at this point in the history
This way possible fallback service wouldn't be triggered for already
disconnected device

QubesOS/qubes-issues#1618
  • Loading branch information
marmarek committed Feb 5, 2016
1 parent d09ed3e commit 19c0747
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/input-proxy-sender.c
Expand Up @@ -2,6 +2,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <poll.h>
#include <errno.h>
#include <linux/input.h>
#include "protocol.h"
#include "common.h"
Expand Down Expand Up @@ -42,6 +43,9 @@ int pass_event(int src_fd, int dst_fd) {
rc = read_all(src_fd, &ev, sizeof(ev));
if (rc == 0)
return 0;
/* treat device disconnect as EOF */
if (rc == -1 && errno == ENODEV)
return 0;
if (rc == -1) {
perror("read");
return -1;
Expand Down Expand Up @@ -119,8 +123,10 @@ int main(int argc, char **argv) {
return 1;

if (ioctl(fd, EVIOCGRAB, 0) == -1) {
perror("ioctl grab");
return 1;
if (errno != ENODEV) {
perror("ioctl grab");
return 1;
}
}

close(fd);
Expand Down

0 comments on commit 19c0747

Please sign in to comment.