Commit 9d65a487 by KATOH Yasufumi Committed by Stéphane Graber

Fix segfault on lxc-create when no template specified

When no template file is specified on lxc-create, recieve segfault. So change not to append header in config when no template is specified. Signed-off-by: 's avatarKATOH Yasufumi <karma@jazz.email.ne.jp> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 47b6e6cf
......@@ -1089,9 +1089,11 @@ static bool lxcapi_create(struct lxc_container *c, const char *t,
lxc_conf_free(c->lxc_conf);
c->lxc_conf = NULL;
if (!prepend_lxc_header(c->configfile, tpath, argv)) {
ERROR("Error prepending header to configuration file");
goto out_unlock;
if (t) {
if (!prepend_lxc_header(c->configfile, tpath, argv)) {
ERROR("Error prepending header to configuration file");
goto out_unlock;
}
}
bret = load_config_locked(c, c->configfile);
......
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