Commit f407c5e4 by Stéphane Graber

utils: Drop trailing / in lxcpath

This fixes command line tools and functions which use lxc_global_config_value o get lxcpath but don't strip the trailing / leading to mismatching command path (as lxc_container_new does strip the path). As lxcpath is typically a const and so can't easily be changed by the caller, add the trick directly into lxc_global_config_value (having to juggle a bit in there too to avoid trying to alter a const). Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent f4364484
......@@ -332,14 +332,25 @@ const char *lxc_global_config_value(const char *option_name)
while (*p && (*p == ' ' || *p == '\t')) p++;
if (!*p)
continue;
values[i] = copy_global_config_value(p);
free(user_default_config_path);
if (strcmp(option_name, "lxc.lxcpath") == 0) {
free(user_lxc_path);
user_lxc_path = copy_global_config_value(p);
remove_trailing_slashes(user_lxc_path);
values[i] = user_lxc_path;
goto out;
}
values[i] = copy_global_config_value(p);
free(user_lxc_path);
goto out;
}
}
/* could not find value, use default */
if (strcmp(option_name, "lxc.lxcpath") == 0) {
remove_trailing_slashes(user_lxc_path);
values[i] = user_lxc_path;
free(user_default_config_path);
}
......
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