chmod_recursive_controller() should return error only when fts_read really
fails, not when it comes to end of directory.

Signed-off-by: Jan Safranek <jsafr...@redhat.com>
---

 src/api.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/api.c b/src/api.c
index 09e6353..f6f806e 100644
--- a/src/api.c
+++ b/src/api.c
@@ -266,9 +266,12 @@ 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;
+                       } else
+                               final_ret = 0;
                        break;
                }
                ret = cg_chmod_file(fts, ent, dir_mode, dirm_change,


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to