diff options
author | Rob Landley <rob@landley.net> | 2016-01-16 16:59:47 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-01-16 16:59:47 -0600 |
commit | 5493916370c74944cc796cc91d058fb4ccabe140 (patch) | |
tree | ce6a45d351c227c0c14083d5f48ae1e8ed919589 /lib/net.c | |
parent | 7279b849f48e2ceb1d35e82e53b14343b708d776 (diff) | |
download | toybox-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.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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; + } +} |