log: Don't crash when name is NULL

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: 's avatarMathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent ce79774f
......@@ -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)
......
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