fsnotifier: interrupted select() calls are now tolerated

This commit is contained in:
Roman Shevchenko
2013-05-30 13:40:36 +04:00
parent 44f88f6ea2
commit e16fc43a33

View File

@@ -217,23 +217,24 @@ static void main_loop() {
int nfds = (inotify_fd > input_fd ? inotify_fd : input_fd) + 1;
fd_set rfds;
struct timeval timeout;
bool go_on = true;
while (go_on) {
while (true) {
FD_ZERO(&rfds);
FD_SET(input_fd, &rfds);
FD_SET(inotify_fd, &rfds);
timeout = (struct timeval){MISSING_ROOT_TIMEOUT, 0};
if (select(nfds, &rfds, NULL, NULL, &timeout) < 0) {
userlog(LOG_ERR, "select: %s", strerror(errno));
go_on = false;
if (errno != EINTR) {
userlog(LOG_ERR, "select: %s", strerror(errno));
break;
}
}
else if (FD_ISSET(input_fd, &rfds)) {
go_on = read_input();
if (!read_input()) break;
}
else if (FD_ISSET(inotify_fd, &rfds)) {
go_on = process_inotify_input();
if (!process_inotify_input()) break;
}
else {
check_missing_roots();