2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 10:39:35 +00:00

confile: fix integer comparisons

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner
2021-09-03 09:35:34 +02:00
parent 45ef2e0c69
commit 15b9e2b099

View File

@@ -21,7 +21,7 @@
#include <sys/types.h>
#include <sys/utsname.h>
#include <syslog.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include "af_unix.h"
@@ -47,6 +47,10 @@
#include "strlcat.h"
#endif
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#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]);