]> git.meshlink.io Git - catta/commitdiff
watch: ignore EINTR in the main loop
authorLennart Poettering <lennart@poettering.net>
Fri, 25 Jun 2010 21:35:01 +0000 (23:35 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 25 Jun 2010 21:35:01 +0000 (23:35 +0200)
avahi-common/simple-watch.c

index 56c2ccb81c0bcb5db1d9e6caf9bb3ef85a4ee5da..8df18dd7737236b2f3fa0956d025d912cfcd90c1 100644 (file)
@@ -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 */