From 72223abd8a3b53f539e020b354bdfbbfc579473d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 25 Jun 2010 23:35:01 +0200 Subject: watch: ignore EINTR in the main loop --- avahi-common/simple-watch.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'avahi-common') 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 */ -- cgit