]> git.meshlink.io Git - catta/blobdiff - avahi-common/simple-watch.c
* avahi-utils: replace python avahi-browse with a version written in C.
[catta] / avahi-common / simple-watch.c
index 6531fb773859dc0d7816908de6cfc1531b52ca23..65d9d18919ce46c6f0ceb009135d75ee6ea97ab1 100644 (file)
@@ -31,9 +31,9 @@
 #include <fcntl.h>
 #include <stdio.h>
 
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-
+#include "llist.h"
+#include "malloc.h"
+#include "timeval.h"
 #include "simple-watch.h"
 
 struct AvahiWatch {
@@ -519,7 +519,7 @@ finish:
 
 int avahi_simple_poll_run(AvahiSimplePoll *s) {
     assert(s);
-    assert(s->state == STATE_PREPARED);
+    assert(s->state == STATE_PREPARED || s->state == STATE_FAILURE);
     
     s->state = STATE_RUNNING;
 
@@ -619,7 +619,7 @@ const AvahiPoll* avahi_simple_poll_get(AvahiSimplePoll *s) {
     return &s->api;
 }
 
-static int system_poll(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata) {
+static int system_poll(struct pollfd *ufds, unsigned int nfds, int timeout, AVAHI_GCC_UNUSED void *userdata) {
     return poll(ufds, nfds, timeout);
 }
 
@@ -640,5 +640,6 @@ int avahi_simple_poll_loop(AvahiSimplePoll *s) {
     
     for (;;)
         if ((r = avahi_simple_poll_iterate(s, -1)) != 0)
-            return r;
+            if (r >= 0 || errno != EINTR)
+                return r;
 }