confile: cleanup set_config_rootfs_options()

parent d8cf0289
...@@ -2591,30 +2591,26 @@ static int set_config_rootfs_mount(const char *key, const char *value, ...@@ -2591,30 +2591,26 @@ static int set_config_rootfs_mount(const char *key, const char *value,
static int set_config_rootfs_options(const char *key, const char *value, static int set_config_rootfs_options(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data) struct lxc_conf *lxc_conf, void *data)
{ {
__do_free char *mdata = NULL, *opts = NULL;
unsigned long mflags = 0, pflags = 0; unsigned long mflags = 0, pflags = 0;
char *mdata = NULL, *opts = NULL;
int ret;
struct lxc_rootfs *rootfs = &lxc_conf->rootfs; struct lxc_rootfs *rootfs = &lxc_conf->rootfs;
int ret;
ret = parse_mntopts(value, &mflags, &mdata); ret = parse_mntopts(value, &mflags, &mdata);
if (ret < 0) if (ret < 0)
return -EINVAL; return ret_errno(EINVAL);
ret = parse_propagationopts(value, &pflags); ret = parse_propagationopts(value, &pflags);
if (ret < 0) { if (ret < 0)
free(mdata); return ret_errno(EINVAL);
return -EINVAL;
}
ret = set_config_string_item(&opts, value); ret = set_config_string_item(&opts, value);
if (ret < 0) { if (ret < 0)
free(mdata); return ret_errno(ENOMEM);
return -ENOMEM;
}
rootfs->mountflags = mflags | pflags; rootfs->mountflags = mflags | pflags;
rootfs->options = opts; rootfs->options = move_ptr(opts);
rootfs->data = mdata; rootfs->data = move_ptr(mdata);
return 0; 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