coverity: #1425867

do not pass NULL pointer to chdir() Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent ae65a0f7
......@@ -1186,9 +1186,11 @@ int lxc_attach(const char *name, const char *lxcpath,
new_cwd = options->initial_cwd;
else
new_cwd = cwd;
ret = chdir(new_cwd);
if (ret < 0)
WARN("Could not change directory to \"%s\".", new_cwd);
if (new_cwd) {
ret = chdir(new_cwd);
if (ret < 0)
WARN("Could not change directory to \"%s\"", new_cwd);
}
free(cwd);
/* Now create the real child process. */
......
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