return 0;
}
+int lxc_clear_environment(struct lxc_conf *c)
+{
+ struct lxc_list *it,*next;
+
+ lxc_list_for_each_safe(it, &c->environment, next) {
+ lxc_list_del(it);
+ free(it->elem);
+ free(it);
+ }
+ return 0;
+}
+
+
int lxc_clear_mount_entries(struct lxc_conf *c)
{
struct lxc_list *it,*next;
lxc_clear_groups(conf);
lxc_clear_includes(conf);
lxc_clear_aliens(conf);
+ lxc_clear_environment(conf);
free(conf);
}
extern int lxc_clear_hooks(struct lxc_conf *c, const char *key);
extern int lxc_clear_idmaps(struct lxc_conf *c);
extern int lxc_clear_groups(struct lxc_conf *c);
+extern int lxc_clear_environment(struct lxc_conf *c);
extern int do_rootfs_setup(struct lxc_conf *conf, const char *name,
const char *lxcpath);
{
struct lxc_list *list_item = NULL;
+ if (!strlen(value))
+ return lxc_clear_environment(lxc_conf);
+
list_item = malloc(sizeof(*list_item));
if (!list_item)
goto freak_out;
return fulllen;
}
+static int lxc_get_item_environment(struct lxc_conf *c, char *retv, int inlen)
+{
+ int len, fulllen = 0;
+ struct lxc_list *it;
+
+ if (!retv)
+ inlen = 0;
+ else
+ memset(retv, 0, inlen);
+
+ lxc_list_for_each(it, &c->environment) {
+ strprint(retv, inlen, "%s\n", (char *)it->elem);
+ }
+ return fulllen;
+}
+
static int lxc_get_item_cap_drop(struct lxc_conf *c, char *retv, int inlen)
{
int len, fulllen = 0;
return lxc_get_item_groups(c, retv, inlen);
else if (strcmp(key, "lxc.seccomp") == 0)
v = c->seccomp;
+ else if (strcmp(key, "lxc.environment") == 0)
+ return lxc_get_item_environment(c, retv, inlen);
else return -1;
if (!v)
lxc_seccomp_free(c);
return 0;
}
+ else if (strncmp(key, "lxc.environment", 15) == 0)
+ return lxc_clear_environment(c);
return -1;
}
fprintf(fout, "lxc.start.order = %d\n", c->start_order);
lxc_list_for_each(it, &c->groups)
fprintf(fout, "lxc.group = %s\n", (char *)it->elem);
+ lxc_list_for_each(it, &c->environment)
+ fprintf(fout, "lxc.environment = %s\n", (char *)it->elem);
}