From: KATOH Yasufumi Date: Wed, 23 Oct 2013 12:00:53 +0000 (+0900) Subject: Fix segfault on lxc-create when no template specified X-Git-Tag: lxc-1.0.0.alpha3~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d65a4872917d4bed744aaddafc99046c588e7ae;p=thirdparty%2Flxc.git 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: KATOH Yasufumi Acked-by: Stéphane Graber --- diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index c8ecef3b2..6e6c38ce6 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -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);