]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
mainloop: move variables into tighter scope 3931/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 11 Aug 2021 13:52:12 +0000 (15:52 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 11 Aug 2021 13:52:12 +0000 (15:52 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/mainloop.c

index 4d3b7cc43e7fd1809cce341bfb1f62150f3c7971..a937c5cc7047353664ed8a56a9be9c8cf1c7db92 100644 (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)
 {
-       int i, nfds, ret;
-       struct mainloop_handler *handler;
-       struct epoll_event events[MAX_EVENTS];
-
        for (;;) {
+               int nfds;
+               struct epoll_event events[MAX_EVENTS];
+
                nfds = epoll_wait(descr->epfd, events, MAX_EVENTS, timeout_ms);
                if (nfds < 0) {
                        if (errno == EINTR)
@@ -328,8 +327,9 @@ static int __lxc_mainloop_epoll(struct lxc_async_descr *descr, int timeout_ms)
                        return -errno;
                }
 
-               for (i = 0; i < nfds; i++) {
-                       handler = events[i].data.ptr;
+               for (int i = 0; i < nfds; i++) {
+                       int ret;
+                       struct mainloop_handler *handler = events[i].data.ptr;
 
                        /* If the handler returns a positive value, exit the
                         * mainloop.