Option -L of cgconfigparser is not working on ext4 file systems. So far this is 
rhel7 issue. Into /etc/cgconfig.d/ create arbitrary config files with group 
definition (without templates). Then run cgconfigparser -L /etc/cgconfig. Run 
lscgroup and observe no group from /etc/cgconfig has appeared. After applying 
this patch, groups are created.

Signed-off-by: jchaloup <jchal...@redhat.com>
---
 src/tools/tools-common.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/tools/tools-common.c b/src/tools/tools-common.c
index 211a49a..6feb579 100644
--- a/src/tools/tools-common.c
+++ b/src/tools/tools-common.c
@@ -201,17 +201,24 @@ int cgroup_string_list_add_directory(struct 
cgroup_string_list *list,
        do {
                errno = 0;
                item = readdir(d);
-               if (item && (item->d_type == DT_REG
-                               || item->d_type == DT_LNK)) {
-                       char *tmp;
+
+               struct stat st;
+
+               char *tmp;
+
+               if (item) {
                        ret = asprintf(&tmp, "%s/%s", dirname, item->d_name);
                        if (ret < 0) {
                                fprintf(stderr, "%s: out of memory\n",
                                                program_name);
                                exit(1);
                        }
+               }
+
+               if (item && (item->d_type == DT_REG
+               || item->d_type == DT_LNK
+                       || (stat(tmp, &st) >= 0 && S_ISREG(st.st_mode)))) {
                        ret = cgroup_string_list_add_item(list, tmp);
-                       free(tmp);
                        count++;
                        if (ret) {
                                fprintf(stderr, "%s: %s\n",
@@ -225,6 +232,10 @@ int cgroup_string_list_add_directory(struct 
cgroup_string_list *list,
                                        program_name, dirname, strerror(errno));
                        exit(1);
                }
+
+               if (item)
+                       free(tmp);
+
        } while (item != NULL);
        closedir(d);
 


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to