diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-12-04 23:31:10 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2013-12-14 16:24:48 +0100 |
commit | fd722494e7b5add462af5163315d85344a775f1f (patch) | |
tree | fdf345b27b5bf9941f13bf5ff7ca9deda388e497 /source3 | |
parent | 952392af38b5558f5dfb858251fce4d22c9a1ec2 (diff) | |
download | samba-fd722494e7b5add462af5163315d85344a775f1f.tar.gz samba-fd722494e7b5add462af5163315d85344a775f1f.tar.xz samba-fd722494e7b5add462af5163315d85344a775f1f.zip |
s3:lib: avoid talloc_zero_array() in poll_one_fd()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3')
-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; } |