mirror of
https://github.com/samba-team/samba.git
synced 2025-07-31 20:22:15 +03:00
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>
This commit is contained in:
committed by
Volker Lendecke
parent
952392af38
commit
fd722494e7
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user