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 321f9db commit b8fbc02
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/input-proxy-sender.c
Expand Up @@ -42,6 +42,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 +122,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 b8fbc02

Please sign in to comment.