fts_read can return NULL in two cases. Either when we have visited all files in the hierarchy (when errno is set to 0) or when an error occured. We shouldn't set an error code in the first case obviously.
Changelog since v1: - updated log message Signed-off-by: Jan Safranek <jsafr...@redhat.com> --- src/api.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/api.c b/src/api.c index 66cc2b3..fd26c6d 100644 --- a/src/api.c +++ b/src/api.c @@ -266,9 +266,11 @@ static int cg_chmod_recursive_controller(char *path, mode_t dir_mode, FTSENT *ent; ent = fts_read(fts); if (!ent) { - cgroup_dbg("fts_read failed\n"); - last_errno = errno; - final_ret = ECGOTHER; + if (errno != 0) { + cgroup_dbg("fts_read failed\n"); + last_errno = errno; + final_ret = ECGOTHER; + } break; } ret = cg_chmod_file(fts, ent, dir_mode, dirm_change, ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel