fix crash when the computer is suspended
This commit is contained in:
parent
9918331491
commit
122ba9b44b
8
hkd.c
8
hkd.c
@ -327,8 +327,10 @@ int main (int argc, char *argv[])
|
|||||||
char buf[EVENT_BUF_LEN];
|
char buf[EVENT_BUF_LEN];
|
||||||
|
|
||||||
/* On linux use epoll(2) as it gives better performance */
|
/* On linux use epoll(2) as it gives better performance */
|
||||||
if (epoll_wait(ev_fd, &ev_type, fd_num, -1) < 0 || dead)
|
if (epoll_wait(ev_fd, &ev_type, fd_num, -1) < 0 || dead) {
|
||||||
break;
|
if (errno != EINTR)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ev_type.events != EPOLLIN)
|
if (ev_type.events != EPOLLIN)
|
||||||
continue;
|
continue;
|
||||||
@ -404,7 +406,7 @@ int main (int argc, char *argv[])
|
|||||||
// interrupts as the father so everything should work fine
|
// interrupts as the father so everything should work fine
|
||||||
wait(NULL);
|
wait(NULL);
|
||||||
if (!dead)
|
if (!dead)
|
||||||
fprintf(stderr, red("an error occured\n"));
|
fprintf(stderr, red("An error occured: %s\n"), errno ? strerror(errno): "idk");
|
||||||
close(ev_fd);
|
close(ev_fd);
|
||||||
close(event_watcher);
|
close(event_watcher);
|
||||||
for (int i = 0; i < fd_num; i++)
|
for (int i = 0; i < fd_num; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user