iplib: Support non-blocking listens
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 20 Jul 2015 12:12:18 +0000 (08:12 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 24 Jul 2015 07:05:14 +0000 (03:05 -0400)
We want to pass the -1 through but not treat it like a full error and
print out something, since non-blocking is a legitimate usage.

user/iplib/announce.c

index ac51fa7..53a0913 100755 (executable)
@@ -105,7 +105,8 @@ listen(char *dir, char *newdir)
        snprintf(buf, sizeof(buf), "%s/listen", dir);
        ctl = open(buf, O_RDWR);
        if(ctl < 0){
-               fprintf(stderr,"listen opening %s: %r\n", buf);
+               if ((errno != EAGAIN) && (errno != EWOULDBLOCK))
+                       fprintf(stderr,"listen opening %s: %r\n", buf);
                return -1;
        }