2
0
mirror of git://github.com/lxc/lxc synced 2025-08-30 09:02:09 +00:00

conf/ile: use lxc_safe_uint() in config_autodev()

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
This commit is contained in:
Christian Brauner 2016-10-28 20:22:35 +02:00
parent a56e2df9cf
commit ff6cb4ed82
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D
2 changed files with 7 additions and 3 deletions

View File

@ -325,7 +325,7 @@ struct lxc_conf {
scmp_filter_ctx seccomp_ctx;
#endif
int maincmd_fd;
int autodev; // if 1, mount and fill a /dev at start
unsigned int autodev; // if 1, mount and fill a /dev at start
int haltsignal; // signal used to halt container
int rebootsignal; // signal used to reboot container
int stopsignal; // signal used to hard stop container

View File

@ -1346,9 +1346,13 @@ static int config_loglevel(const char *key, const char *value,
static int config_autodev(const char *key, const char *value,
struct lxc_conf *lxc_conf)
{
int v = atoi(value);
if (lxc_safe_uint(value, &lxc_conf->autodev) < 0)
return -1;
lxc_conf->autodev = v;
if (lxc_conf->autodev > 1) {
ERROR("Wrong value for lxc.autodev. Can only be set to 0 or 1");
return -1;
}
return 0;
}