From 5493916370c74944cc796cc91d058fb4ccabe140 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 16 Jan 2016 16:59:47 -0600 Subject: Move create_uuid() to lib and xpoll() to lib/net.c. --- lib/net.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/net.c') 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; + } +} -- cgit v1.2.3