]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tools: fix build warnings
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 3 Sep 2021 15:29:04 +0000 (17:29 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 3 Sep 2021 15:30:16 +0000 (17:30 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc_monitor.c
src/lxc/tools/lxc_unshare.c

index 2ecc55c4390d46d413ae1501a1ca41bc4635b2e6..aeb5ed8d0dfb9960f336ec93ce64dbd7cc8621c8 100644 (file)
@@ -185,8 +185,9 @@ static int lxc_tool_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]);
 
@@ -207,7 +208,7 @@ static int lxc_tool_monitord_spawn(const char *lxcpath)
        close(pipefd[0]);
 
        ret = snprintf(pipefd_str, sizeof(pipefd_str), "%d", pipefd[1]);
-       if (ret < 0 || ret >= sizeof(pipefd_str)) {
+       if (ret < 0 || (size_t)ret >= sizeof(pipefd_str)) {
                ERROR("Failed to create pid argument to pass to monitord");
                _exit(EXIT_FAILURE);
        }
index a0ef5f618f3de8ee6604345d4fe2d33b478d630e..c77ac70e7a446ed11c8f0dd122857b809ff42cac 100644 (file)
@@ -149,14 +149,14 @@ static bool lookup_user(const char *oparg, uid_t *uid)
        struct passwd pwent;
        struct passwd *pwentp = NULL;
        char *buf;
-       size_t bufsize;
+       ssize_t bufsize;
        int ret;
 
        if (!oparg || (oparg[0] == '\0'))
                return false;
 
        bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
-       if (bufsize == -1)
+       if (bufsize < 0)
                bufsize = 1024;
 
        buf = malloc(bufsize);