forked from external/yambar
module/battery: handle poll() failures
This commit is contained in:
parent
6612a9af9f
commit
f922973450
1 changed files with 9 additions and 1 deletions
|
@ -428,7 +428,15 @@ run(struct module *mod)
|
|||
{.fd = mod->abort_fd, .events = POLLIN},
|
||||
{.fd = udev_monitor_get_fd(mon), .events = POLLIN},
|
||||
};
|
||||
poll(fds, 2, m->poll_interval > 0 ? m->poll_interval * 1000 : -1);
|
||||
if (poll(fds, sizeof(fds) / sizeof(fds[0]),
|
||||
m->poll_interval > 0 ? m->poll_interval * 1000 : -1) < 0)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
|
||||
LOG_ERRNO("failed to poll");
|
||||
break;
|
||||
}
|
||||
|
||||
if (fds[0].revents & POLLIN) {
|
||||
ret = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue