Unverified Commit e60ed84f by Christian Brauner Committed by Stéphane Graber

confile: config_start()

parent be8c9cb3
...@@ -1179,28 +1179,47 @@ static int config_pts(const char *key, const char *value, ...@@ -1179,28 +1179,47 @@ static int config_pts(const char *key, const char *value,
} }
static int config_start(const char *key, const char *value, static int config_start(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf)
{ {
if (config_value_empty(value)) bool is_empty;
return 0;
is_empty = config_value_empty(value);
if(strcmp(key, "lxc.start.auto") == 0) { if (strcmp(key, "lxc.start.auto") == 0) {
/* Set config value to default. */
if (is_empty) {
lxc_conf->start_auto = 0;
return 0;
}
/* Parse new config value. */
if (lxc_safe_uint(value, &lxc_conf->start_auto) < 0) if (lxc_safe_uint(value, &lxc_conf->start_auto) < 0)
return -1; return -1;
if (lxc_conf->start_auto > 1) if (lxc_conf->start_auto > 1)
return -1; return -1;
return 0; return 0;
} else if (strcmp(key, "lxc.start.delay") == 0) {
/* Set config value to default. */
if (is_empty) {
lxc_conf->start_delay = 0;
return 0;
}
/* Parse new config value. */
return lxc_safe_uint(value, &lxc_conf->start_delay);
} else if (strcmp(key, "lxc.start.order") == 0) {
/* Set config value to default. */
if (is_empty) {
lxc_conf->start_order = 0;
return 0;
}
/* Parse new config value. */
return lxc_safe_int(value, &lxc_conf->start_order);
} }
else if (strcmp(key, "lxc.start.delay") == 0) {
if (lxc_safe_uint(value, &lxc_conf->start_delay) < 0)
return -1;
return 0;
}
else if (strcmp(key, "lxc.start.order") == 0) {
if (lxc_safe_int(value, &lxc_conf->start_order) < 0)
return -1;
return 0;
}
SYSERROR("Unknown key: %s", key); SYSERROR("Unknown key: %s", key);
return -1; return -1;
} }
......
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