From 74f052ddfb9dc6f1f61b2d4557536c4c84f116c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Graber?= Date: Fri, 7 Feb 2014 09:15:39 -0500 Subject: [PATCH] log: Don't crash when name is NULL MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes a crash in lxc-autostart following the addition of lxc_log_init as lxc-autostart doesn't use the name property. Signed-off-by: Mathieu Trudel-Lapierre Acked-by: Stéphane Graber --- src/lxc/log.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lxc/log.c b/src/lxc/log.c index 6706f9071..f0b8ff0b9 100644 --- a/src/lxc/log.c +++ b/src/lxc/log.c @@ -191,6 +191,9 @@ static char *build_log_path(const char *name, const char *lxcpath) char *p; int len, ret, use_dir; + if (!name) + return NULL; + #if USE_CONFIGPATH_LOGS use_dir = 1; #else @@ -326,6 +329,10 @@ extern int lxc_log_init(const char *name, const char *file, if (geteuid()) return 0; + /* if no name was specified, there nothing to do */ + if (!name) + return 0; + ret = -1; if (!lxcpath) -- 2.47.2