2
0
mirror of git://github.com/lxc/lxc synced 2025-09-04 00:49:31 +00:00

mainloop: move variables into tighter scope

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner
2021-08-11 15:52:12 +02:00
parent 14f8022a59
commit 1306659ecb

View File

@@ -315,11 +315,10 @@ static int __lxc_mainloop_io_uring(struct lxc_async_descr *descr, int timeout_ms
static int __lxc_mainloop_epoll(struct lxc_async_descr *descr, int timeout_ms) static int __lxc_mainloop_epoll(struct lxc_async_descr *descr, int timeout_ms)
{ {
int i, nfds, ret;
struct mainloop_handler *handler;
struct epoll_event events[MAX_EVENTS];
for (;;) { for (;;) {
int nfds;
struct epoll_event events[MAX_EVENTS];
nfds = epoll_wait(descr->epfd, events, MAX_EVENTS, timeout_ms); nfds = epoll_wait(descr->epfd, events, MAX_EVENTS, timeout_ms);
if (nfds < 0) { if (nfds < 0) {
if (errno == EINTR) if (errno == EINTR)
@@ -328,8 +327,9 @@ static int __lxc_mainloop_epoll(struct lxc_async_descr *descr, int timeout_ms)
return -errno; return -errno;
} }
for (i = 0; i < nfds; i++) { for (int i = 0; i < nfds; i++) {
handler = events[i].data.ptr; int ret;
struct mainloop_handler *handler = events[i].data.ptr;
/* If the handler returns a positive value, exit the /* If the handler returns a positive value, exit the
* mainloop. * mainloop.