udev_monitor.c: check poll error early

This commit is contained in:
illiliti
2021-06-03 09:37:13 +03:00
parent 37e5fa7206
commit fb44266bfd

View File

@@ -137,14 +137,14 @@ static void *handle_event(void *ptr)
return NULL;
}
// exit on poll error
if (!(poll_fds[0].revents & POLLIN)) {
return NULL;
}
len = read(udev_monitor->ifd, data, sizeof(data));
if (len == -1) {
continue;
}
// exit on ifd error or close
if (!(poll_fds[0].revents & POLLIN)) {
return NULL;
}