diff options
-rw-r--r-- | source3/lib/util_sock.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index a35ae97eba..12e4ccdcce 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -1490,27 +1490,18 @@ int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res) int poll_one_fd(int fd, int events, int timeout, int *revents) { - struct pollfd *fds; + struct pollfd pfd; int ret; - int saved_errno; - fds = talloc_zero_array(talloc_tos(), struct pollfd, 1); - if (fds == NULL) { - errno = ENOMEM; - return -1; - } - fds[0].fd = fd; - fds[0].events = events; + pfd.fd = fd; + pfd.events = events; - ret = poll(fds, 1, timeout); + ret = poll(&pfd, 1, timeout); /* * Assign whatever poll did, even in the ret<=0 case. */ - *revents = fds[0].revents; - saved_errno = errno; - TALLOC_FREE(fds); - errno = saved_errno; + *revents = pfd.revents; return ret; } |