mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +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)
|
int poll_one_fd(int fd, int events, int timeout, int *revents)
|
||||||
{
|
{
|
||||||
struct pollfd *fds;
|
struct pollfd pfd;
|
||||||
int ret;
|
int ret;
|
||||||
int saved_errno;
|
|
||||||
|
|
||||||
fds = talloc_zero_array(talloc_tos(), struct pollfd, 1);
|
pfd.fd = fd;
|
||||||
if (fds == NULL) {
|
pfd.events = events;
|
||||||
errno = ENOMEM;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
fds[0].fd = fd;
|
|
||||||
fds[0].events = events;
|
|
||||||
|
|
||||||
ret = poll(fds, 1, timeout);
|
ret = poll(&pfd, 1, timeout);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assign whatever poll did, even in the ret<=0 case.
|
* Assign whatever poll did, even in the ret<=0 case.
|
||||||
*/
|
*/
|
||||||
*revents = fds[0].revents;
|
*revents = pfd.revents;
|
||||||
saved_errno = errno;
|
|
||||||
TALLOC_FREE(fds);
|
|
||||||
errno = saved_errno;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user