From: Christian Brauner Date: Fri, 3 Sep 2021 07:35:34 +0000 (+0200) Subject: confile: fix integer comparisons X-Git-Tag: lxc-5.0.0~92^2~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15b9e2b099421b17a7afdfe0a0cd24f18a125ef4;p=thirdparty%2Flxc.git confile: fix integer comparisons Signed-off-by: Christian Brauner --- diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 9a2fcc3fc..6b1cfd4be 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include "af_unix.h" @@ -47,6 +47,10 @@ #include "strlcat.h" #endif +#if HAVE_SYS_RESOURCE_H +#include +#endif + lxc_log_define(confile, lxc); #define lxc_config_define(name) \ @@ -2540,7 +2544,7 @@ static int set_config_console_buffer_size(const char *key, const char *value, if (buffer_size == 0) return ret_errno(EINVAL); - if (buffer_size != size) + if (buffer_size != (uint64_t)size) NOTICE("Passed size was not a power of 2. Rounding log size to next power of two: %" PRIu64 " bytes", buffer_size); lxc_conf->console.buffer_size = buffer_size; @@ -2585,7 +2589,7 @@ static int set_config_console_size(const char *key, const char *value, if (log_size == 0) return ret_errno(EINVAL); - if (log_size != size) + if (log_size != (uint64_t)size) NOTICE("Passed size was not a power of 2. Rounding log size to next power of two: %" PRIu64 " bytes", log_size); lxc_conf->console.log_size = log_size; @@ -3216,7 +3220,7 @@ int lxc_config_parse_arch(const char *arch, signed long *persona) { "x86_64", PER_LINUX }, }; - for (int i = 0; i < ARRAY_SIZE(pername); i++) { + for (size_t i = 0; i < ARRAY_SIZE(pername); i++) { if (!strequal(pername[i].name, arch)) continue; @@ -4508,7 +4512,7 @@ static int get_config_init_groups(const char *key, char *retv, int inlen, if (c->init_groups.size == 0) return 0; - for (int i = 0; i < c->init_groups.size; i++) + for (size_t i = 0; i < c->init_groups.size; i++) strprint(retv, inlen, "%s%d", (i > 0) ? "," : "", c->init_groups.list[i]);