From: Christian Brauner Date: Fri, 3 Sep 2021 15:29:04 +0000 (+0200) Subject: tools: fix build warnings X-Git-Tag: lxc-5.0.0~92^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09618fb8abd37b6bec5d691904799ef937a503b6;p=thirdparty%2Flxc.git tools: fix build warnings Signed-off-by: Christian Brauner --- diff --git a/src/lxc/tools/lxc_monitor.c b/src/lxc/tools/lxc_monitor.c index 2ecc55c43..aeb5ed8d0 100644 --- a/src/lxc/tools/lxc_monitor.c +++ b/src/lxc/tools/lxc_monitor.c @@ -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); } diff --git a/src/lxc/tools/lxc_unshare.c b/src/lxc/tools/lxc_unshare.c index a0ef5f618..c77ac70e7 100644 --- a/src/lxc/tools/lxc_unshare.c +++ b/src/lxc/tools/lxc_unshare.c @@ -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);