]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
monitor: fix integer comparisons
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 3 Sep 2021 10:54:57 +0000 (12:54 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 3 Sep 2021 11:01:43 +0000 (13:01 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/monitor.c

index 1c1d7039a21c7fd5ed93294e28847c131cc5f18c..b013551683586dd03e9a91b0dfbae00160616def 100644 (file)
@@ -224,7 +224,6 @@ int lxc_monitor_open(const char *lxcpath)
 int lxc_monitor_read_fdset(struct pollfd *fds, nfds_t nfds, struct lxc_msg *msg,
                           int timeout)
 {
-       long i;
        int ret;
 
        ret = poll(fds, nfds, timeout * 1000);
@@ -236,7 +235,7 @@ int lxc_monitor_read_fdset(struct pollfd *fds, nfds_t nfds, struct lxc_msg *msg,
        /* Only read from the first ready fd, the others will remain ready for
         * when this routine is called again.
         */
-       for (i = 0; i < nfds; i++) {
+       for (size_t i = 0; i < nfds; i++) {
                if (fds[i].revents != 0) {
                        fds[i].revents = 0;
                        ret = recv(fds[i].fd, msg, sizeof(*msg), 0);
@@ -327,8 +326,9 @@ int lxc_monitord_spawn(const char *lxcpath)
                 * synced with the child process. the if-empty-statement
                 * construct is to quiet the warn-unused-result warning.
                 */
-               if (lxc_read_nointr(pipefd[0], &c, 1))
+               if (lxc_read_nointr(pipefd[0], &c, 1)) {
                        ;
+               }
 
                close(pipefd[0]);