From 9d65a4872917d4bed744aaddafc99046c588e7ae Mon Sep 17 00:00:00 2001 From: KATOH Yasufumi Date: Wed, 23 Oct 2013 21:00:53 +0900 Subject: [PATCH] Fix segfault on lxc-create when no template specified MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/lxc/lxccontainer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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); -- 2.47.2