summaryrefslogtreecommitdiffstats
path: root/api.c
diff options
context:
space:
mode:
Diffstat (limited to 'api.c')
-rw-r--r--api.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/api.c b/api.c
index ac5fcbb..336e14a 100644
--- a/api.c
+++ b/api.c
@@ -2251,6 +2251,9 @@ static int cg_walk_node(FTS *fts, FTSENT *ent, const int depth,
int ret = 0;
int base_level;
+ if (!cgroup_initialized)
+ return ECGROUPNOTINITIALIZED;
+
cgroup_dbg("seeing file %s\n", ent->fts_path);
info->path = ent->fts_name;
@@ -2291,6 +2294,9 @@ int cgroup_walk_tree_next(const int depth, void **handle,
FTS *fts = *(FTS **)handle;
FTSENT *ent;
+ if (!cgroup_initialized)
+ return ECGROUPNOTINITIALIZED;
+
if (!handle)
return ECGINVAL;
ent = fts_read(fts);
@@ -2308,6 +2314,9 @@ int cgroup_walk_tree_end(void **handle)
int ret = 0;
FTS *fts = *(FTS **)handle;
+ if (!cgroup_initialized)
+ return ECGROUPNOTINITIALIZED;
+
if (!handle)
return ECGINVAL;
fts_close(fts);
@@ -2328,6 +2337,9 @@ int cgroup_walk_tree_begin(char *controller, char *base_path, const int depth,
FTSENT *ent;
FTS *fts;
+ if (!cgroup_initialized)
+ return ECGROUPNOTINITIALIZED;
+
if (!cg_build_path(base_path, full_path, controller))
return ECGOTHER;