This patch adds return value checks to two occurrences of fts_open command calls

Signed-off-by: Ivana Hutarova Varekova <[email protected]>
---

 src/api.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/api.c b/src/api.c
index 1d2d111..a971ecd 100644
--- a/src/api.c
+++ b/src/api.c
@@ -158,6 +158,10 @@ static int cg_chown_recursive(char **path, uid_t owner, 
gid_t group)
        cgroup_dbg("chown: path is %s\n", *path);
        fts = fts_open(path, FTS_PHYSICAL | FTS_NOCHDIR |
                                FTS_NOSTAT, NULL);
+       if (fts == NULL) {
+               last_errno = errno;
+               return ECGOTHER;
+       }
        while (1) {
                FTSENT *ent;
                ent = fts_read(fts);
@@ -2830,6 +2834,10 @@ int cgroup_walk_tree_begin(const char *controller, const 
char *base_path,
 
        entry->fts = fts_open(cg_path, FTS_LOGICAL | FTS_NOCHDIR |
                                FTS_NOSTAT, NULL);
+       if (entry->fts == NULL) {
+               last_errno = errno;
+               return ECGOTHER;
+       }
        ent = fts_read(entry->fts);
        if (!ent) {
                cgroup_dbg("fts_read failed\n");


------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to