aboutsummaryrefslogtreecommitdiff
path: root/lib/net.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-01-16 16:59:47 -0600
committerRob Landley <rob@landley.net>2016-01-16 16:59:47 -0600
commit5493916370c74944cc796cc91d058fb4ccabe140 (patch)
treece6a45d351c227c0c14083d5f48ae1e8ed919589 /lib/net.c
parent7279b849f48e2ceb1d35e82e53b14343b708d776 (diff)
downloadtoybox-5493916370c74944cc796cc91d058fb4ccabe140.tar.gz
Move create_uuid() to lib and xpoll() to lib/net.c.
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;
+ }
+}