From: Lennart Poettering Date: Fri, 25 Jun 2010 21:35:01 +0000 (+0200) Subject: watch: ignore EINTR in the main loop X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=72223abd8a3b53f539e020b354bdfbbfc579473d;p=catta watch: ignore EINTR in the main loop --- diff --git a/avahi-common/simple-watch.c b/avahi-common/simple-watch.c index 56c2ccb..8df18dd 100644 --- a/avahi-common/simple-watch.c +++ b/avahi-common/simple-watch.c @@ -521,9 +521,19 @@ int avahi_simple_poll_run(AvahiSimplePoll *s) { s->state = STATE_RUNNING; - if (s->poll_func(s->pollfds, s->n_pollfds, s->prepared_timeout, s->poll_func_userdata) < 0) { - s->state = STATE_FAILURE; - return -1; + for (;;) { + errno = 0; + + if (s->poll_func(s->pollfds, s->n_pollfds, s->prepared_timeout, s->poll_func_userdata) < 0) { + + if (errno == EINTR) + continue; + + s->state = STATE_FAILURE; + return -1; + } + + break; } /* The poll events are now valid again */