Hello,
sorry for the delay, I just look to this patch. Please could you put some 
example how can I reproduce the problem. I try to test it but I was 
unsuccessful. Thanks.
Ivana

----- Original Message -----
> From: "Jan Chaloupka" <jchal...@redhat.com>
> To: libcg-devel@lists.sourceforge.net
> Sent: Monday, March 31, 2014 2:06:09 PM
> Subject: [Libcg-devel] [PATCH] tools-common.c: xfs file system sets 
> item->d_type to zero, stat() and S_ISREG() test
> added
> 
> Sorry, it is tools-common.c file.
> 
> On 03/31/2014 02:04 PM, Jan Chaloupka wrote:
> > On xfs file system, item->d_type is set to zero for all types. Adding
> > additional or test using stat() and S_ISREG() fixes this problem.
> >
> > Signed-off-by: Jan Chaloupka<jchal...@redhat.com>
> > ---
> >    src/tools/tools-common.c | 23 +++++++++++++++++------
> >    1 file changed, 17 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/tools/tools-common.c b/src/tools/tools-common.c
> > index 211a49a..48aed59 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;
> > -            ret = asprintf(&tmp, "%s/%s", dirname, item->d_name);
> > +
> > +                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);
> >                }
> > -            ret = cgroup_string_list_add_item(list, tmp);
> > -            free(tmp);
> > +        }
> > +
> > +        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);
> >                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);
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Libcg-devel mailing list
> Libcg-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libcg-devel
> 

------------------------------------------------------------------------------
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