diff options
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; + } +} |