Skip to content

Commit

Permalink
conf/ile: use lxc_safe_u/int() in config_start()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
  • Loading branch information
Christian Brauner authored and stgraber committed Nov 22, 2016
1 parent 773d583 commit e68d7e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/lxc/conf.h
Expand Up @@ -343,8 +343,8 @@ struct lxc_conf {

int inherit_ns_fd[LXC_NS_MAX];

int start_auto;
int start_delay;
unsigned int start_auto;
unsigned int start_delay;
int start_order;
struct lxc_list groups;
int nbd_idx;
Expand Down
11 changes: 8 additions & 3 deletions src/lxc/confile.c
Expand Up @@ -1147,15 +1147,20 @@ static int config_start(const char *key, const char *value,
struct lxc_conf *lxc_conf)
{
if(strcmp(key, "lxc.start.auto") == 0) {
lxc_conf->start_auto = atoi(value);
if (lxc_safe_uint(value, &lxc_conf->start_auto) < 0)
return -1;
if (lxc_conf->start_auto > 1)
return -1;
return 0;
}
else if (strcmp(key, "lxc.start.delay") == 0) {
lxc_conf->start_delay = atoi(value);
if (lxc_safe_uint(value, &lxc_conf->start_delay) < 0)
return -1;
return 0;
}
else if (strcmp(key, "lxc.start.order") == 0) {
lxc_conf->start_order = atoi(value);
if (lxc_safe_int(value, &lxc_conf->start_order) < 0)
return -1;
return 0;
}
SYSERROR("Unknown key: %s", key);
Expand Down

0 comments on commit e68d7e3

Please sign in to comment.