Commit 16ba55ae by Christian Brauner Committed by Stéphane Graber

conf/ile: avoid atoi() in config_ephemeral()

parent 856a5733
......@@ -377,7 +377,7 @@ struct lxc_conf {
gid_t init_gid;
/* indicator if the container will be destroyed on shutdown */
int ephemeral;
unsigned int ephemeral;
};
#ifdef HAVE_TLS
......
......@@ -2955,13 +2955,12 @@ bool network_new_hwaddrs(struct lxc_conf *conf)
static int config_ephemeral(const char *key, const char *value,
struct lxc_conf *lxc_conf)
{
int v = atoi(value);
if (lxc_safe_uint(value, &lxc_conf->ephemeral) < 0)
return -1;
if (v != 0 && v != 1) {
if (lxc_conf->ephemeral > 1) {
ERROR("Wrong value for lxc.ephemeral. Can only be set to 0 or 1");
return -1;
} else {
lxc_conf->ephemeral = v;
}
return 0;
......
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