[This patch is of debatable value, given the prior patch to cgroup_create_cgroup_from_parent(), and that this is an internal function.]
Check for cgroup without controllers to prevent segfault, as the current implementation depends upon a controller being configured. Signed-off-by: Eric Brower <[email protected]> diff --git a/src/api.c b/src/api.c index 908878e..f486ddd 100644 --- a/src/api.c +++ b/src/api.c @@ -1502,6 +1502,12 @@ static int cgroup_find_parent(struct cgroup *cgroup, char **parent) *parent = NULL; + /* if cgroup has no controllers attached, consider it unconfigured */ + if (cgroup->controller[0] == NULL) { + cgroup_dbg("cgroup_find_parent called on unconfigured group\n"); + return ECGFAIL; + } + pthread_rwlock_rdlock(&cg_mount_table_lock); controller = cgroup->controller[0]->name; if (!cg_build_path_locked(cgroup->name, child_path, controller)) { -- E ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Libcg-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libcg-devel
