Unverified Commit 3a3dcd34 by 2xsec

tools: lxc-ls: fix signed_to_bigger_unsigned issue

Signed-off-by: 's avatar2xsec <dh48.jeong@samsung.com>
parent f2c0c2bf
...@@ -308,7 +308,7 @@ static char *ls_get_config_item(struct lxc_container *c, const char *item, ...@@ -308,7 +308,7 @@ static char *ls_get_config_item(struct lxc_container *c, const char *item,
if (running) if (running)
return c->get_running_config_item(c, item); return c->get_running_config_item(c, item);
size_t len = c->get_config_item(c, item, NULL, 0); int len = c->get_config_item(c, item, NULL, 0);
if (len <= 0) if (len <= 0)
return NULL; return NULL;
...@@ -316,7 +316,7 @@ static char *ls_get_config_item(struct lxc_container *c, const char *item, ...@@ -316,7 +316,7 @@ static char *ls_get_config_item(struct lxc_container *c, const char *item,
if (!val) if (!val)
return NULL; return NULL;
if ((size_t)c->get_config_item(c, item, val, len + 1) != len) { if (c->get_config_item(c, item, val, len + 1) != len) {
free(val); free(val);
val = NULL; val = NULL;
} }
...@@ -612,7 +612,7 @@ out: ...@@ -612,7 +612,7 @@ out:
static char *ls_get_cgroup_item(struct lxc_container *c, const char *item) static char *ls_get_cgroup_item(struct lxc_container *c, const char *item)
{ {
size_t len = c->get_cgroup_item(c, item, NULL, 0); int len = c->get_cgroup_item(c, item, NULL, 0);
if (len <= 0) if (len <= 0)
return NULL; return NULL;
...@@ -620,7 +620,7 @@ static char *ls_get_cgroup_item(struct lxc_container *c, const char *item) ...@@ -620,7 +620,7 @@ static char *ls_get_cgroup_item(struct lxc_container *c, const char *item)
if (!val) if (!val)
return NULL; return NULL;
if ((size_t)c->get_cgroup_item(c, item, val, len + 1) != len) { if (c->get_cgroup_item(c, item, val, len + 1) != len) {
free(val); free(val);
val = NULL; val = NULL;
} }
...@@ -630,7 +630,7 @@ static char *ls_get_cgroup_item(struct lxc_container *c, const char *item) ...@@ -630,7 +630,7 @@ static char *ls_get_cgroup_item(struct lxc_container *c, const char *item)
static char *ls_get_groups(struct lxc_container *c, bool running) static char *ls_get_groups(struct lxc_container *c, bool running)
{ {
size_t len = 0; int len = 0;
char *val = NULL; char *val = NULL;
if (running) if (running)
...@@ -640,7 +640,7 @@ static char *ls_get_groups(struct lxc_container *c, bool running) ...@@ -640,7 +640,7 @@ static char *ls_get_groups(struct lxc_container *c, bool running)
if (!val && (len > 0)) { if (!val && (len > 0)) {
val = malloc((len + 1) * sizeof(*val)); val = malloc((len + 1) * sizeof(*val));
if ((size_t)c->get_config_item(c, "lxc.group", val, len + 1) != len) { if (c->get_config_item(c, "lxc.group", val, len + 1) != len) {
free(val); free(val);
return NULL; return NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment