aboutsummaryrefslogtreecommitdiff
path: root/lib/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net.c')
-rw-r--r--lib/net.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/net.c b/lib/net.c
index 48d0a5fe..facb0968 100644
--- a/lib/net.c
+++ b/lib/net.c
@@ -42,3 +42,15 @@ int xconnect(char *host, char *port, int family, int socktype, int protocol,
return fd;
}
+
+int xpoll(struct pollfd *fds, int nfds, int timeout)
+{
+ int i;
+
+ for (;;) {
+ if (0>(i = poll(fds, nfds, timeout))) {
+ if (errno != EINTR && errno != ENOMEM) perror_exit("xpoll");
+ else if (timeout>0) timeout--;
+ } else return i;
+ }
+}